Hi Sarav,
For question -
Is that possible to update the portlet preference value in the wcm template
I don't think it is possible.
Refer -
CMS templates linkIn wiki page it's written -
The processing of a template is handled in such a way that it is not dependent on access to a real HttpRequest of any kind. Why? Because it's done WITHIN the service call. We do not allow our service layer objects to have an HttpRequest or HttpResponse of any kind as parameters. Thus, we can't add any of those NON-serializable objects like HttpServletRequest, ThemeDisplay, PortletDisplay, PortletPreferences, etc...
HTH!
Archi