There’s a simple expression to help you create repetitive motion in After Effects with less keyframes: loopOut()

It continues movement by looping the motion after the last keyframe.

In this video example, I show you how to use it to loop the changing position of a layer. To use the expression, simply keyframe an initial movement. Then, create an expression for the Position property and type loopOut(). This will continue your keyframed motion indefinitely.

If you ever need to change your motion, such as by increasing or decreasing the duration of the motion, you only need to adjust one keyframe. The loopOut() expression will take care of the rest.