Will this circuit act as a switch?
No, it's wrong. You have used N-channel mosfet. Change it to P-channel mosfet and change gate driving to 5V, and it will work.







simulate this circuit &ndash; Schematic created using CircuitLab