It's important to remember that cartoons from the era of Yosemite Sam's creation (the 1940s and 1950s) were subject to stricter censorship standards than today. While they could use violence and slapstick humor, actual curse words were generally avoided.
So, to answer your question directly, Yosemite Sam likely never actually said "hell" in a cartoon. He may have used other phrases that were considered more "family-friendly" but carried a similar level of frustration or anger.