First of all TURN OFF THE POWER to the circuit you are working on
If there are colored wires at the old fan remove them first
Then fron your center light in the bath room take two wires red/black or new colors brown / blue they will connect to the fan.
There are two black wires on the new...
It better to keep the fan away from above the shower as the steam will damage it over time ,
A 4 inch fan is for moving air not to remove steam
To remove steam a 6 inch wall mount fan with motorised lover would be reconmended.