Hello,
- There is no problem in giving a written undertaking to your wife to withdraw her petition and you can resume your marriage. Please know that you are not signing up your death warrant. It does not matter you are admitting that you had made a few mistakes and you intend to reform.
- If you are afraid of consequences that follow, don' worry. No court can prosecute you on basis of an undertaking you provided. It is only your attempt to resurrect your marriage. Nothing untoward can happen without both parties involvement in a marriage. However, as you want to save your marriage, go ahead and sign an undertaking of no repeating mistakes. It is fine to do so.