Actions due to Unethical practices

Hello All, I need help and supportive guidance on my issue as below. I was hired by a company A and this company A also has sister concern company B. Due to no work in company A i started working for company B. They were no official communication that was done to take care of business development on company B. In company B we used to import products from Europe and sell in Indian market through distributors. But i did a mistake here. I opened a firm in my friend's name and started buying products imported by company B- for my friend's firm- and sold to customers. The mobile number for my friends company also belongs to me also there were financial transactions between the friends' firm and my bank account. Now I was caught and terminated - Now company had issued me letter that they will recover the money that i may have earned through my friends firm and also go legal if I do not pay. My F&F settlement is also not done and also due to this my name is spoiled in the market and no job opportunities are available. I am on streets now with high EMI 's to be paid and no back support. Where do I stand legally and how do i proceed??