How to tighten a pipe while keeping it at specific angle?
Your picture doesn't quite give enough information. I think you are saying that whatever that box is (a water heater?) connects to a threaded pipe coming out of the wall. Am I right?

If so, the other end of that pipe is probably also threaded. Remove the water heater, then use a pipe wrench to remove the threaded pipe from the wall. Get a new pipe that is a bit longer.

FYI- Teflon tape isn't a sealant. The Teflon reduces the friction so that the joint can be tightened further than it could without.