Changing the polarity of electromagnet using H-Bridge
Firstly, do you need to alternate the polarity rapidly? Rapid switching of 9A through an inductive load such as an electromagnet requires some care.

If not, the easiest solution is probably to use a pre-built H-bridge driver module designed for a single DC brushed motor, such as this one, which has as a 5V interface suitable for an Arduino. Similar things (often less well designed/documented) are available cheaply on ebay.