Read PWM duty from a pin and write PWM to a pin

CORRECT!
The semicolon terminates all your if statements…. lose all of them !
Cheers.