The reason they could use "hell" sometimes and not others was a matter of how it was being used. You could use it in reference to the mythical place -- e.g. "I'll chase you to the very fires of Hell!" in "The Alternative Factor," "Better to rule in Hell than serve in Heaven" in "Space Seed," or "devil... right out of Hell" in "The Doomsday Machine" -- or in an expression like "hell-for-leather, right out of history" in "Spectre of the Gun" or "the private hells" in "Requiem for Methuselah." But you couldn't generally use it as an expletive, like "go to hell" or "what the hell" or "the hell with you." That's why they had to fight the censors to get away with "Let's get the hell out of here" that one time.
By the same token, TOS was able to say "the evidence is damning" in "Court Martial" and "I can't damn him for his loyalty" in "Journey to Babel," but they never had a "damn it" or "not a damn thing" or "damn you." You could use it as a verb, but not as a curse word. Context mattered.
So in TOS, characters only ever said things like "blast it" or "what in Heaven's name," and then the movies came along and there were people saying "what the hell" and "damn it" all over the place. (The cliche of McCoy saying "Damn it, Jim, I'm a doctor, not a..." never actually happened until Star Trek Beyond. His only "Damn it, Jim" in the Prime universe was in TWOK, before "What the hell's the matter with you?" And the first two Kelvin movies had "Damn it, man, I'm a doctor, not a...", but not directed at Jim.)
You can see the same with other profanities -- sometimes the same word has a "clean" usage that's allowed on TV and a "dirty" usage that isn't. Like you could have a character named Dick or talk about a "private dick" (detective), but any sexual use of the term would be forbidden.