Just tell him you made a mistake. Even grown ups do that.
It is an inappropriate word.
That's what I do.
My kids correct me when I do/say things like that. I then apologize.
And even Mommy, will try her best.
Its a phase.
Nothing earth shattering.
Main thing they know, that at school.... it is a big no-no word, especially.
I tend to say "damn it..." and once I said "F**k it..." under my breath, and then my son said it.
Well, I just explained to him... NO that is Mommy's mistake, its a bad word not for him to say. It is really an icky word etc.
They understand.
But yes, its not nice to see and hear our kids say that.
They must know, it is off limits.
And, I just teach my kids to say other words, for it.
Such as: "Oh popcorn.... !", or "Oh, shazbot..." or, whatever they can make up that is funny... not offensive. For frustrations. And they understand.