Theory:

If the measurement of the line segment is unknown, but a similar line segment is required, then the already existing line segment could be copied to form the desired line segment.
Copying of a line segment
Step $$1$$: Place one end of the compass on one end of the line segment and the other end of the compass on the other end of the line segment.

In the figure given above, $$\overline{\rm AB}$$ is being copied using a compass.

Step $$2$$: Now draw a new line on the sheet of paper.

Step $$3$$: By keeping the measurement obtained using the compass intact, place the pointy end of the compass anywhere on the line and draw an arc over the line using the pencil end.

Step $$4$$: The point on the line where the pointy end was placed becomes one end of the line segment, while the point where the arc and the line meets becomes the other end of the line segment.

Using the same measurement of $$\overline{\rm AB}$$, $$\overline{\rm CD}$$ is formed.

In other words, $$\overline{\rm AB} = \overline{\rm CD}$$

If the arc does not fall over the line segment, keep extending the line until it meets the arc at some point.