How to program ATmega8U2
You need a programmer/debugger. Atmel (now Microchip) sells a suitable device, or you could use an Arduino with suitable software as a programmer only. The latter will be a lot cheaper.