I would consider "dammit", "damn it" and "damnit" all to be acceptable. As soon as you leave "damn it" you're in slang territory anyway, so personal variations are acceptable.
(I will also accept "dagnammit", "dognarnit" and "magnabbit".)
"(exclamation) Oldcootism used during great consternation or surprise. Used by 1890’s prospectors, cantankerous old farmers, and young people playing old people on TV in the ‘60’s and ‘70’s."
(I will also accept "dagnammit", "dognarnit" and "magnabbit".)