Not able to generate different voltages from Arduino PWM & MOSFET

You can make the IRF530 work for you by adding an additional bipolar transistor and a few resistors.

Look for Q26 in Post #3 in This Thread.

AnalogWrite is expecting int data type.
Change float val[4]....
To int val[4].... and remove the decimals