how to generate an analog output from a in-built pwm of Atmega 32AVR microcontrloller?
you need a resistor, a capacitor and an opamp. 

opamp is not really necessary when you are driving a mosfet, but will make life a bit easier.



just be aware, that this dac will be quite noisy or/and slow. The bigger cap/resistor values, quiter and slower the output.

another thing to be aware is that you better use 16bit pwm, as 8 bit pwm will give you only 256 discrete values - that could be enough or too coarse, depends on your application, of course.

just google "PWM DAC" for more info and calculations.

EDIT

one more thing - you could put several resistor/capacitor stages in series to improve on the noise side: