I can't reproduce that.
My apologies - I couldn't quite read the error message in the screen dump. What you got was:
Don't know end address for 0
Please add to table: end_addresses
[string "Immediate"]:96: Cannot continue
[C]: in function 'error'
[string "Immediate"]:96: in function 'process'
[string "Immediate"]:134: in main chunk
The relevant error is the first line. That file has code for address 0 - which is not part of the bootloader. It tries to detect bootloader addresses, and zero is not one of them. Looking at the start of the file I see this:
In particular the format is:
:10 0000 00 90C00000A9C00000A7C00000A5C00000 6B
^ ^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^
len addr TT data sumcheck
So this file includes code for the Atmega16U2 as well as the bootloader.
My sketch is not designed to program non-bootloaders (it is a bootloader programmer after all).
Scroll down that page for how to reprogram the Atmega16U2 chip.
The bootloader programmer sketch (as published) will put the bootloader onto the Atmega16U2. Then follow the instructions on that page, or on this page, below, for entering DFU mode and uploading the main part of the code (not the bootloader part).
Entering DFU mode
If you have just flashed the bootloader using the bootloader programmer sketch then it should enter DFU mode, visible because the pin 13 LED flashes rapidly.
If not, enter DFU mode by shorting together Reset and Ground briefly with a screwdriver or similar. They are the two left-most pins visible in the image above, nearest to the Reset button and below the hole on the board.
(Don't keep them shorted, just a brief touch should do it).
Once in DFU mode, you should see it appear as an Atmel USB device, if you type
lsusb (on Linux):
Bus 003 Device 092: ID 03eb:2fef Atmel Corp.
A Uno which is not in USB mode might look like this:
Bus 003 Device 090: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
(or not appear at all if there is no firmware on it).
If you are using Ubuntu or similar you can obtain the DFU programmer as follows:
sudo apt-get install dfu-programmer
You can obtain the code for the firmware from here:
(RH-click and "save as" to put a copy on your hard disk).
Assuming you place that firmware in the current directory of your terminal window, you can now flash the code as follows:
sudo dfu-programmer atmega16u2 flash Arduino-atmega16u2-Uno-firmware-Rev3.hex
You should see a message like:
4034 bytes used (32.83%)
Now you can unplug the USB cable, plug it back in, and the USB interface should be back to factory settings.
For other operating systems, such as Windows, you should be able to get a copy of the DFU programmer from: