Aruna,
If your range is 0 to 5V, you can use a DAC like MCP4912 (Microchip) which can be written through SPI. If you need higher voltage at the output, the DAC output can be amplified by a non inverting amplifier.
In case you dont want to use a DAC, you can generate a PWM, and connect a RC low pass filter to get a linear output voltage. ensure the RC time constant is greater than your PWM cycle time, otherwise you may end up getting a triangular wave.
Using a DAC will give you more accuracy. Hope this helps.
Regards,
JayantD