There is plenty of missing info here . @zenofmud asked where are you using this code?
This example is accessed via the browser at http://your-node-red-ip:1880/chart?y=100.
where y is the hieght you want the red line.
[{"id":"df0e482b.f561b8","type":"http in","z":"30af2d3e.d94ea2","name":"","url":"/chart","method":"get","upload":false,"swaggerDoc":"","x":240,"y":140,"wires":[["85667b0.dd41088"]]},{"id":"85667b0.dd41088","type":"template","z":"30af2d3e.d94ea2","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head> \n <title>chart.js 2.1</title> \n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> \n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.bundle.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-annotation/0.5.7/chartjs-plugin-annotation.min.js\"></script>\n \n </head> \n <body> \n <div>\n <input type=\"number\" id=\"meta\">\n <button onclick=\"updateChart()\">Botao</button>\n <canvas id=\"linechart\" width=\"800\" height=\"450\"></canvas>\n </div>\n \n\n\n <script>\n let diogo = ''\nconst data = {\n labels: [1500,1600,1700,1750,1800,1850,1900,1950,1999,2050],\n datasets: [{ \n data: [200,114,150,106,20,111,25,221,50,-60],\n label: \"Africa\",\n borderColor: \"#3e95cd\",\n fill: false\n }\n ]\n }\n\n // config \n const config = {\n type: 'line',\n data,\n options: {\n title: {\n display: true,\n text: 'World population per region (in millions)'\n },\n annotation: {\n annotations: [{\n drawTime: 'afterDraw', \n id: 'a-line-1', \n type: 'line',\n value:{{payload.y}},\n mode: 'horizontal',\n scaleID: 'y-axis-0',\n borderColor: 'red',\n borderWidth: 5,\n }]\n }\n }\n };\n\n // render init block\n const myChart = new Chart(\n document.getElementById('linechart'),\n config\n );\n\n \n function updateChart(linechart) {\n myChart.config.data.datasets[0].data[0] = document.getElementById('meta').value;\n myChart.options.annotation.annotations[0].value = document.getElementById('meta').value;;\n //diogo = document.getElementById(\"meta\").value;\n myChart.update();\n };\n </script>\n\n </body>\n</html>","output":"str","x":390,"y":160,"wires":[["f2e53274.36e308"]]},{"id":"f2e53274.36e308","type":"http response","z":"30af2d3e.d94ea2","name":"","statusCode":"","headers":{},"x":580,"y":160,"wires":[]}]
Without a clear understanding on where you want to use this code it is difficult to answer your question.