i would remove the current keyframes, then duplicate the shape layer and maybe change the color of the duplicate line (you'll use the duplicate as a reference to line up the original line, so having it look different from the origin will help).
then add a position keyframe for the original line in it's current position at the first frame. move down the time line some amount and reposition that shape layer to move the direction needed, but line it up with the duplicate line.
if you shorten the work area in the timeline to match your keyframes and preview, it should loop pretty well. you might notice a slight hitch at the endpoint. this is due to the first and last keyframe positions lining up perfectly. to eliminate that hitch, move backwards one frame from the last position keyframe and add a new keyframe, then delete the last keyframe. adjust the work area and make sure it loops correctly.
now you can use a simple expression to make that animation loop. select the position property and choose animation>add expression. then copy/paste this expression:
if you expand the work area back out and preview the animation, it should loop continuously (and seamlessly).