You can write both the name of a segment and the name of a line using two points; for the line, it is two points on the line; for the segment, it is the two endpoints of the segment.
The symbols we use are different for a segment and a line. Let the points on both the segment and the line be AB. For the segment, we draw a line segment (without endpoints or arrows) over the letters:
For the line, we draw a line with arrows at each end over the letters:
If the two points of a line segment are A and B, you write it as AB with a straight line over the top. ----- AB
If the two points of a line are A and B, you write it as AB with a double sided arrow over the top. <-----> AB
If the two points of a ray are A and B, you write it as AB with a one sided arrow over the top (the side with the arrow depends on which way the ray is pointing) Either: <----- ------> AB OR AB