If i'm understanding some of these heredoc tutorials properly, you can redirect with a heredoc like this
Using Stdout of sudo -u
sudo -u someuser -c bash <<EOF
{
foo
bar
} >> /tmp/somefile.txt
EOF
and like this, redirecting stdin
sudo -u someuser -c cat <<EOF >/tmp/somefile.txt
foo
bar
EOF
Is there a benefit to one over the other? Am I understanding this correctly?