I'm having problems with the MOSFET. I tried out with a simple circuit and it seems that even though I put the input source as 0V, the MOSFET is still on. I don't understand.
Your circuit shows a P-channel Mosfet. You have it connected the wrong way round. So in your circuit the substrate diode is conducting and so it appears to be on. It's not, the diode is conducting.
Start by reversing the source and drain terminals. So the source goes to the positive supply.
Then connect a resistor (say 1k ohm) between the gate and the source. This will ensure it is switched off. (ensures the gate-source voltage is zero). Don't leave the gate un-connected.
To switch it on, you have to make the gate more negative than the source. Do not put more than about -15V on the gate (compared to the source) or you will destroy the mosfet.
With your 50V supply and the 1k gate-source resistor connected as above, if you connect a 3.9k resistor from the gate to the negative output of your 50V supply you should get about -10V between the gate-source and the mosfet should switch on.