I tried using resistor as potential divider. But that didn't work. Somehow it would give 12v at output. I found a regulator lying around. Although I have never used a regulator like that , this time I tried and it did work properly. So far no errors. If you could tell me the problems that I might encounter using a regulator there, I would be thankful to you.