How to control external voltage via PWM

I guess a N-MOSFET might help. (A Logic level one). By applying a PWM signal to the Gate you can control the voltage and current that flows out from the output.

Set the Buck converter for max output.

Then follow this schematic:

image (Output: + wire not the GND).
This should work. You can use any Logic level N-Channel MOSFET.

HTH.