`sudo echo blah > /etc/file.txt` doesn’t work
that is because the shell is interpreting redirect first.
with my guideline to put the redirect first in the command it becomes more obvious.
try
sudo “echo bla >/etc/file.txt”
or
sudo sh -c “echo bla >/etc/file.txt”