Regarding H1B CAP of my current VISA

I went to US from Company A and the moved to Company B later to Company C. I had to return back to India in 2019 due to personal reasons. My petition of Company A is not revoked but my Petition of Company B and C has been revoked. I still have 2+ years of my VISA left, Am i eligible to get a VISA transfer under the CAP limit or do I need to go for the lottery again? Please let me know.

You dont need to go through lottery. New employer can file cap-exempt H1B petition for you and claim the remainder of H1B term of 6 years.