What is the difference? How is the first used?
What in the hell?
What the hell?
How in the hell?
How the hell?
And what other examples are there?
These are purely idiomatic phrases, there is no systematic pattern of grammar here. Other similar examples "What the devil..." or the minced oath "What the Dickens..."
And if I may advise, if you need to ask about an offensive or insulting phrase, then you don't know enough to use it convincingly.
Such uses of "in the" may date back to when hell, or heaven, were commonly regarded as actual places that a person could be in. But few if any, people who now use such phrases still take that view.
When this is combined with the use of minced oaths where part of the original expression is replaced with one of a similar sound or spelling, but a completely different meaning (if any), where "in" likely makes no separate sense at all, these must be regarded as idioms or fixed phrases, that cannot be computationally analyzed.
It is not always the case that a version with "in" is stronger than one without. That may vary by region and by dialect.