On machine 1
dpkg --get-selections "*" > file.txt
Note - the "*" is important - otherwise you don't get the required purge lines
On machine 2
dpkg --set-selections < file.txt apt-get dselect-upgrade