You can simply write on the similar lines as below -
Dear Sir,
This is with reference to my resignation dated ....... for the post of ........... in this company.
It was unfortunate that I had taken this decision of leaving for ....................(reason) and I realized that it was a wrong step / wrong decision by me.
After re-considering the best course of action, I would like to take my resignation back and
wish to continue my work. Hence, request you not to take any action on my resignation.
I would like to put forth that I will do my best to fulfill the requirements of my position and thereby achieve my departmental / organizational objectives.
Hope you will positively consider my case.
Thanking you.
Yours truly