The voltage waveforms shown in your simulation for V(Val) suggests that your IRF530 is not turning fully on.
You can check this by raising the gate voltage pulses in your simulation to 10V, to see what happens. If the output voltage corrects itself, then the problem has been isolated.
Indeed, one would expect that the V(Val) would never rise to more than the input voltage minus the MOSFET threshold voltage.
There are various ways to drive a high-side N-channel MOSFET. This video discusses some of the methods available to drive a high-side N-channel MOSFET. An alternative is to use a P-channel MOSFET for your switch (and adjust the duty cycle for the reversed polarity).
You can also improve the situation a bit with a MOSFET with a lower threshold voltage. However, you will still see a voltage drop through the MOSFET when the gate voltage is at the drain voltage. So unless there is some obstacle to one of the various gate driving mechanisms available, or there is an obstacle to using a P-channel MOSFET, I would recommend using one of those two methods.
Reversing the drain and source of the MOSFET runs into the problem that the IRF530, like most common power MOSFETs has an internal body diode connection between source and drain. If connected so that that the source is more positive than the drain, (by one diode voltage drop), the device will conduct, regardless of the voltage on the gate.