To execute a multiline shell command in php:
passthru("bash <<'END'
echo \"executed in new bash session\";
pwd;
whoami;
exit;
END
");
This way you could for example connect to a ssh server using php and then execute some commands there
I don't understand what you mean by cat > abc.txt
. This command will empty the file.