Hi, thank you for contacting JustAnswer.com. My name is Russell. I will do my best to provide the right answer to your question.
Does the variation occur in the actual heading of the vessel, rather than on the instrument first and foremost?
You may have either a problem in the gear that the piloting device drives, such as extreme looseness in the steering gear, or you might have a problem with the motor that the pilot device drives, that in turn drives the steering gear.
(Or, rarely, you might have a problem with the autocompass that tells the pilot what your actual heading/bearing is. Check on it too, see whether its indications match with the yawing of the vessel, or whether they precede it... if they precede it, then the autocompass is defective somehow. But this is rare, I think.)
Another thing to check: see whether when on manual steering, your heading/bearing is steadier, for several hundred feet of sailing. If it is steady, then the compass/gear/motor/pilot is OK, except for the autopilot functions perhaps!