ssh -p 21 
[email protected] <<EOF
  echo 'printing pwd'
  echo "\$(pwd)"
  ls -a
  find '*.txt'
EOF
$ is escaped because we do not want it to be expanded by the current shell i.e $(pwd) is to be executed on the remote shell.
Another way:
ssh -p 21 
[email protected] <...