A line consisting of two endpoints and all points between is called a line segment, according to Wolfram MathWorld. A line segment is a closed interval that corresponds to one section of an infinite line.
Both a line and a line segment are straight one-dimensional figures that are without width or thickness, but unlike a line segment, the length of a line is theoretically infinite, stretching on forever in opposite directions.
Another one-dimensional figure closely related both to a line and a line segment is a ray. In geometry, a ray is conceptualized as a semi-infinite line. One side has an endpoint, as does a line segment, but the other continues endlessly, which is a feature associated with lines.