With PWM you can not get a voltage higher than what you supply. Eventually you can connect the 12V battery "on top" of the 5V supply for a total of 17V.
That would be a variable "boost-buck DC-DC converter".
I haven't seen any DIY programmable power supply (or regulator) modules, and computer-controllable benchtop power supplies are expensive.
I assume you know that PWM is NOT variable DC. It can be filtered to DC, but of course it can't put-out "power", it's only 5V, and with a passive filter you're going to get even less current.
So that filtered 0-5V could (in theory) be amplified to 14V, but you'd need a 14V+ power source. And depending on how much power you need, a linear amplifier can be fairly simple or very-hard to make.
A voltage regulator uses feedback to set the voltage and an adjustable linear regulator (like the LM317) uses a voltage divider (2 resistors) so while it's voltage reference is always the same, the actual output-voltage depends on the resistor ratio. Use a pot and you've got a (manually) adjustable regulator. There's probably a way to use a differential amplifier in place of (or in addition to) the voltage divider, along with your variable voltage from filtered PWM.
You should have a "deep understanding" of how the LM317 works before you play-around with anything like that.
The LM317 is limited to less than 1 AMP in most applications.
A switching regulator could probably be controlled in a similar way but switching regulators are already finicky and changing ANYTHING could cause it to oscillate or burn-up.
Thank you for the detailed answer.
I could use a dc dc step up converter to get a solid 14 or 18v as a powersupply. There is not a lot of power needed maybe max 1 or 0,5A.
One is that it has no heatsinking - is is only ever intended to operate as a switching device, not as a linear controller, so you cannot feed it with a voltage smoothed from PWM by a resistor and capacitor.
And while the module can be used to PWM the load current, you cannot smooth that with only a capacitor and adding a resistor would severely limit the load current. You would need an inductor and capacitor to do so.