Yes, I too spend a fair bit of time as root but I wouldn’t like to encourage anyone else to do that in any permanent documentation. So that means correctly making each individual command work when not logged in as root.
The | sudo tee hack is one approach. Another is to introduce a one-line shell script. A third is
sudo bash -c '... >root_writeable_file' but that may lead to quote-hell.