GPS can measure only position, and even then, only to limited accuracy. To drive in a straight line, you need another sensor.
A magnetometer (electronic compass) works well to determine robot heading, if it is properly calibrated and not subject to interference from motor magnets or metal objects.
Another approach is to use wheel encoders, and make sure that the encoders total up the same number of counts on each side of the robot, as it travels along.
The simplest approach with wheel encoders is PID steering, where the steering guide (PID INPUT) is the difference between encoder counts.
Finally, any external reference mark can be used: a visual scene caught by a camera, a bright light source, etc.