It depends on what you want to do with the elevation information.
If you want the elevation stored in the attribute table, you have to convert the line to points. QGIS can't store data "at any point on a vector line" because the line only has one entry in the attribute table.
First convert your line to points, using the
extract vertices or
points along geometry algorithm.
Use the GRASS algorithm
v.sample or the QGIS algorithm
Sample raster values to apply the raster data to the points as an attribute.
Note: all algorithms mentioned in the answer can be found in the Processing Toolbox.
If you want to find the elevation at a single point along the line, you can use the Identify tool in "Top Down" mode.
If you want to get the elevation in the expression builder, you can use the
raster_value() function, for example:
Again it requires a point rather than a line as input. There are various ways to write a point into the equation, for example using the