A rack with gear teeth arranged in a straight line, and a gear that meshes with it is a pinion.
Small gears are also called pinions.
The rack moves linearly as the pinion rotates.
So it becomes a mechanism that can change the rotation to linear motion.
However, since the teeth of the rack do not continue indefinitely, the pinion must switch the rotation direction somewhere.