If Output is negative you have to turn the motor in the other direction.
Wasn't able to get it correct, Some more light?