You have reprogrammed the ATMega16U2 chip to be a HID device. Thus it no longer functions as a serial interface between the Atmega328P and your computer. You need to reflash the firmware on the ATMega16U2 to return to normal operation.
I have instructions for how you might to this on my bootloader uploader page. In brief, you need to put the original hex file back:
sudo dfu-programmer atmega16u2 flash Arduino-atmega16u2-Uno-firmware-Rev3.hex
There are other ways of turning your Uno into a HID device. Search for "Virtual USB Arduino".
More easily, get a Arduino Leonardo or Arduino Micro which are designed for this sort of thing.
Yes but how can I use it as a HID? ... it cannot detect it so how would I be able to upload code to it ...
What is "it" here? Look at this photo:
There are two processors on the Uno. It sounds like you have reflashed the ATMega16U2. Do you want to use the ATMega16U2 as a HID or the Atmega328P as a HID? They need totally different techniques.
Once you reflash the ATMega16U2 you can't "get to" the Atmega328P via the USB interface.
On the page you linked there is a workflow for programming the ATMega16U2. Are you following it? If so, which part is not working for you? If not, why not? [1]: https://i.sstatic.net/W0qfY.jpg