How to politely turn down an on-site faculty interview offer
Dear [name of person you were communicating with],
I have an update about my job search. Since we last talked I‘ve received a tenure track job offer from another institution, and have accepted it. Consequently, I am withdrawing my application at your department, and am cancelling my upcoming interview with you and your colleagues.
I do very much appreciate that you considered me for the position, and hope that we will have occasion to meet in the future.
Sincerely,
[your name]

P.S. Congrats on the job!!!