AP swings left to right all the time

Whenever I use autopilot for flights with a planned route, the autopilot will swerve left and right constantly. Ive seen this on the a320, 747, and cj4. Is there a way to fix this?