It’s hard to walk on a straight heading for most people. A simple trick helps. Pick a landmark on the horizon, walk toward it checking for it periodically, and once you reach it pick a new distant land mark in the direction you’d like to travel and repeat.
Of course this requires knowing which direction is which. That’s a separate skill using gps, compass, sun, moon, stars, moss, or whatever.