You have posted that:
“Now they are asking me to pay the 2 months salary else they will sue me. “
They are asking verbally or in writing?
Has the company issued acknowledgment and acceptance of resignation?
First of all peruse and obtain acceptance and FNF statement, and reply that you shall do the needful after company has supplied the correct FNF statement and affirm to pay the payables by you as per FNF statement.
Then demand to supply you the PF number, PF accumulation reports, work experience/service certificate, attested copies of PF withdrawal or transfer forms as suitable to you, form 16, NOC/NDC etc, and reliving letter too.
You may refer to the appointment letter issued to you and clause on termination, notice period and notice pay in lieu of notice period.
If there is no clause mentioning notice period, then there is no notice period applicable to you. Hence you may reply there is notice period as per terms and conditions of appointment letter issued to you.
if you are appointed as trainee then it is felt that there should be no notice period.
If you were under probation period, 2 months notice period seems to be unreasonable.
Refer to SE act applicable to your state if the same is applicable to your establishment.