If it's always off in the same direction, you need to check your step/direction signal timing.

If you have the timing wrong, then every time the axis changes direction, it can move one step in the wrong direction, which will accumulate over long jobs.