Pot may have battery voltage on one side, Gnd on the other, and output an analog level.

analogWrite outputs a digital pulse stream. You need to low pass filter that, remove the pot lead, and wire to the board in place of the pot's wiper. Connect Arduino Gnd the pot's Gnd also.



Measure the voltage on the wiper and see if it's compatible with +5/Gnd from Arduino before connecting. If it's swinging more than 0-5V, then you will need to do more, or something else.