Bash commands not working after SFTP script

EOF is not at the beginning of the line. Changing your script to:

#!/bin/sh
sftp -b /dev/stdin server <<EOF
  cd /shares/backup/webserver/
  put $bu_PATH$BACKUP_FILE
  quit
EOF

echo "Backup done"

should make it work.

You might replace /dev/stdin server by - as the latter means stdin.