PCF8574AN configured as output for relay

it is just the software what is not working fine.

It looks fine to me.

Have you got pull up resistors?
Are you using the analogue pins 4 & 5 not the digital ones?
Have you got the anode of the LED connected to 5V, cathode to a resistor and resistor to the PCF output pin?