Problem with my WD My Passport not recognized

My external hard drive hard drive’s light is on but it is not recognized in my macbook air unless i wiggle the cable in or something like that but lately it doesnt work when i do the cable thingy. What seems to be the problem here and how to fix it??
P.S I havent tried another cable
P.S I tried it on another windows laptop and it didnt work either unless i wiggle it in also
Edit : it worked one time now when i pushed the cable in and pressed on it but i still want to get rid of that and make it work when i just put the cable in

Hello Ossama Tammam,

It could be due to the USB port of the drive may have gone bad. You can try different cable to isolate the issue.

If the issue still persists, you can replace the drive with Western Digital, if it is under warranty.

https://support-en.wd.com/app/answers/detail/a_id/10336

If i replace the drive do i lose my data?