I would not.
It will greatly reduce your heating efficiency if the heating element is in direct contact with the iron wall of the tub (because you’ll be heating the tub wall rather than the water).
I don’t know about the risk of shock. You’d have to check the manufacturer’s specs to see if it’s listed as submergible. I mean, the cord/element electrical connection is certainly weatherproof, but that’s not the same as “ok to submerge 24/7”. I personally wouldn’t take the risk. But no matter what kind of heater you use, get a GFI outlet installed so it will trip if there’s any kind of electrical fault.
To keep our trough heaters in the trough, I just put a cinderblock in the water trough and anchor the heater to it.