First, thanks for your help
It comes from the book, Hearts In Atlantis, written by Stephen King, and
the paragraph having it is like this:
Bobby wasn't exactly sure what his mom did during her days at the office, but he bet it beat making shoes or picking apples or lighting the Tip-Top Bakery ovens at four-thirty in the morning. Bobby bet it beat those jobs all to heck and gone.
I don't believe it is a set expression, but a comic expression --and predates the author Stephen King by many decades --but seeing it always makes me laugh, which I think is the intention.
Yes, "heck" is used, or was used, as a euphemism for Hell, and decades ago very religious people thought the word Hell should only be used in its biblical/religious meaning, and that is was blasphemous to use it as a common way of swearing about other things, or use it in any other way.
Even so, it was always acceptable in writing or speech to say "War is Hell" or "Prison is Hell" since these are nightmarish tortuous environments.
To suddenly reverse the usage and substitute "heck" --which has got the power of watered-down lemonade or the weakest tea served by your unmarried proper aunt--is mocking the euphemism itself.
to Hell and gone would mean someone has been banished forever by into the land of eternal torture and fire.
to heck and gone would mean they have been banished forever into the land of lemonade, or something equally bland and mild, so you are laughing at the very meaning of "heck" which is NOT called for here.
Heck is a euphemism for hell. To hell and gone means "to a very great degree or distance" (gone meaning beyond, here). Of course, beat is in the sense of to out-perform; be better than. The job his mom did was incomparably better than his job.