How to append a directory name after an ls ouptut results?

directory.txt file contains 2 records.
May
June

Once inside the ftp session.
The May directory includes a text file called 5.txt
The June directory includes a text file called 6.txt and 106.txt

How to get results inside out.txt?
5.txt,May
6.txt,June
106.txt,June

Here is the script:

DIRECTORY=`cat directory.txt|sed '/^$/d'`

(
exec 4>&1
ftp -n>&4 2>&4|&

print -p open $host
print -p user $user $password
print -p binary
for D1 in $DIRECTORY; do
print -p cd "$D1"
print -p ls|awk '{print ",$D1"}' #This doesn't work
done
print -p bye
wait
)>>"out.txt