How do I keep a C172 straight on the centerline during landing/rollout?
My guess here would be that you are not truly tracking the centerline of the runway on final or on roundout.  There’s an easy way to solve that when flying final:  if the runway centerline appears pure vertical from your perspective in the airplane while stationary in your field of view, you are tracking the centerline.  If it has a slight angle to it or is translating, then you’re not totally on centerline. 

The differences can be subtle, but can lead to flying a serpentine track toward the runway on final, during roundout, and during ground roll.  It can also result in a touchdown with a slight drift to it which indicates poor piloting technique.

To counter this, first, remember to get the final approach stabilized ie on centerline, on glidepath, and on airspeed as soon as possible after rolling out from the base to final turn.  Remember the more corrections you need to make to do this closer to the runway threshold, the more difficult the approach becomes and the more likely errors in technique will grow unchecked.  Once on a stable final approach, observe the runway centerline and judge if it is a vertical, straight line.  If so, you’re tracking straight down the centerline.  If not, use shallow, coordinated turns to align the airplane so.  This technique will also work when flying a crabbed final in crosswind conditions.

As you roundout, remember you are in slow flight at an increased AoA, so the propeller will tend to pull the airplane’s nose to the left.  Use additional right rudder to prevent this and track straight.

After touchdown, use quick precise feetwork for rudder inputs - think “happy feet happy feet happy feet” - to track centerline.  Also, if doing a crosswind landing, DON’T RELAX AILERON PRESSURE AFTER TOUCHDOWN or the airplane will tend to veer off centerline rapidly.  Remember, fly the airplane all the way through the landing, including the complete rollout.