I not know how do this with AE animation software but I do this in Blender:
Basic theory (see picture) for real camera or software:
• Want repeat image every n animation frames
• Assume camera view is w × h pixels
• For camera view w pixels wide, minimum need draw picture wide 2w pixels wide
• Copy picture two times and put left/right each other (draw left and right edge of image for can't see edge)
• Shift picture -w pixels for first animation frame relative to camera left edge
• Step size for each animation frame is ∆s = w/n
• Image position = ∆s*(animation frame number mod n), means at every n animation frames shift image back -w pixels (return to start position)
• Use linear interpolation for image position (need select this for Blender)
• Use repeat cycle (for Blender)

Blue dot show shift for each animation frame
If image is wider than camera view (R ≥ w):
• shift picture -R pixels for start animation frame
• step become ∆s = R/n
• shift image back -R pixels
Reverse Direction
• Shift picture 0 pixels for first animation frame relative to camera left edge
• Step for each animation frame is ∆s = –w/n (∆s = –R/n for image R ≥ w), negative direction