My wife gave a false complaint for 498A

Hi, my name is Rashid and I am living in erode, tamilnadu. I was married to my first wife on 2015 and our marriage last for 6 years. We got seperated because we didn't have a child. I am an NRE working in Saudi Arabia and during COVID times my first wife was in india and I was in Saudi Arabia. That time I got married to my school friend through online. I informed my first wife that I got married and she insisted me to say talaq through WhatsApp. I said talaq three times and her parents called me through phone and said that their daughter wants to marry another guy and need a full time settlement of 50 lakhs and she pronounced talaq e bain in front of her family members. While I was working in Saudi Arabia one day I am getting a call from police station stating that I have to come to chennai for the settlement of money. Police was the mediating that time and insisted me to pay 30 lakhs as a full time settlement and they gave me 5 days time to settle it and they took my signature in the paper stating that I will pay the 30 lakhs within 5 days. The next day I contacted advocated and he advised me to go to Saudi Arabia to continue my job and I took his advice and left india. Police contacted me and I informed them that I left india for my work commitments. Last year in September 2023 I came to india to meet my parents in chennai and from airport they remanded me through LOC and I was sent to jail and I don't have any idea of filing the FIR. My advocate cheated me by getting money from the opposite parties and I stayed in prison for more than 5 months. Later I got bail with conditional that I have to deposit 6 lakhs to court and the charge sheet was filed. Few days back the opposite advocate asked me for compromise and insisted me to pay my first wife 50 lakhs and they will quash the first. I am in such situation where my first advocate and second advocate cheated me because of money. Now I don't have money to eat and pay the rent in india. My second wife got new baby child and my job is still in Saudi Arabia. How can I go to Saudi when the case is in trial. Please help me. Do I need to settle out of court or can I quash the fir. Please advise