Legal notice from previous employer because of breached undertaking

Hello All, I was working for a software company and resigned from there 2 months back. After that I joined the competitor company which is working for same client as my previous employer. I got the legal notice from my previous company for joining competitor for same client. My previous company made me sign a contract or undertaking on non judicial document( not on bond paper or company letter head) for not joining any client or competitor company for the period of 1 year. I had no other choice other than signing that contract as they would have fired me. That legal notice says I have to pay big amount as my previous companies contract is still valid for next 6 months and they spend some amount on me to upskill, otherwise they will drag me to the court. I already consulted a lawyer, one of them is telling to resign will be a better option and another lawyer told nothing to worry. You are free to work for anyone no one can stop you . But resigning is very difficult for me at this point of time. Please help me in this situation, as I am not sure what to do next.