So right now the pendrive is not working normally when connected to a PC, right? Could you open Disk Management and check if the drive is correctly recognized with a correct file format? If the drive is not recognized or appears with wrong file format even after formatting the drive, it may have been damaged. If the drive has a drive letter, run the Command Prompt and use the command chkdsk L: /r where L must be pendrive’s drive letter.
Hope this helps