Hi Sindhu,
There are 2 ways you can solve this:
    "shapes": [
        {
            "line": {
                "color": "rgb(255, 0, 0)",
                "dash": "dash",
                "width": 2
            },
            "type": "line",
            "x0": 0,
            "x1": 1,
            "xref": "paper",
            "y0": {userYValue},
            "y1": {userYValue}
        }
    ]
	In this instance x0 should be 0 and x1 should be 1 as this references the graph domain (due to the xref = paper)