here-doc convert 2 script convert to single script?

I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into.

main.sh

#!/bin/ksh
getLS.sh > output.txt

getLS.sh

#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!

Basically I'd like to be able to combine the second script into the first and not have to call a second script.

Would this work?

#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!
> output.txt

If it does work, why does it work?
I've always been using the stdout redirect like this:
command > output..

I didn't know you could do
command1
command2
command3
> output..

#!/bin/sh
/home<..>/sftp <host@ip> >output.txt <<!
cd /some/dir/Log
ls -alt
quit
!

I don't have the sftp handy right now, but Solaris' stock ftp client can store the ouput of the 'ls' on the local machine.

Also:

/home<..>/sftp <host@ip> <<! > output.txt 2>&1
............
............
!