To change the sign you need to switch the polarisation of the coil. So that is very simple, using digital.out and switch between high and low. But the coil needs 12v and the arduino only gifs only max 9v. Using a transitory is maybe a solution, but I don’t know how.
Polarization is a property of a component - a polarized capacitor is not symmetrical, but for connecting
circuits we say polarity, not polarization - isn't language complicated!