What is in database? Or is it created via touch each time it is run?
Also, why is the time stamp (better use date function by the way) on its own line above the mac address?
Normally you would see it in the same line.
Also, as the data would appear to only contain this information, why are the colons ( being removed?
My general suggestion would be to change all of your output files to variables.
The database file is just a file stored on the usb drive that can later be imported into another program. This is going to be run on a couple hundred machines, each time adding to the file.
The timestamp is on its own line because if it was on the same line as the info, the awk command wouldn't see it as a duplicate because the time is different.
The colons are removed because the program that the database will be read by only reads macs without colons.
My output files are files and not variables because when they are created and deleted, they are written to the usb which make the light flicker, which is useful because the computers aren't going to have monitors hooked up to them. Kind of a ghetto progress bar.