You want the background to be very wide. Larger than the render dimensions and as high as you plan to pan up and down.
Then you animate the layer's x translation as your character moves. The character doesn't move, the background does.
If the background needs to loop then you would need a seamless background. One where both ends "match" up. At the end of the movement of the background put in two key frames right next to each other the second key frame snaps the background back to the start and you can copy and paste as many loops as you need.
Or you could leave the background stationary and move the camera. The character would then need to move to keep up with the camera. Looping would be similar. Just have the background with a single hold key frame that snaps it back as the camera passes that point.
Creating several layers and translating at different speeds creates the illusion of depth.