Green’s Dictionary of Slang

god-damn it! excl.

also goddam(m)it!

[mid-19C+] a general excl. of exasperation.