Digital signal will be momentary; a delay after the digitalWrite, digitalWrite can be either HIGH or LOW as needed.
Two digitalWrite's one to turn on; the other to turn off.
I was wrong MOSFET circuit will be switching 5 Volts; not the 12 Volt battery that is supplying the buck converter...