How to set PSU voltage using Arduino?
To make a crude "lab supply" you might have more luck with a schematic like this:







simulate this circuit &ndash; Schematic created using CircuitLab

Do note that this simple circuit has limitations. The LM358 cannot drive it's output to 12 V, it can do up to about 8 V. Then there's the Vt of the MOSFET meaning that Vout can go up to around 6 V or so.

Since the feedback divider circuit (R3, R4) sets a gain of 2, for 6 V at the output you will need an average PWM voltage of 3 V.