I tried to accomplish this with sudo echo "New line to write" >> file.txt but I get a permission denied error — presumably because it is trying to sudo the string, not the act of appending it to a file.