You first need to do the restore. I don't remember if that will actually restore the $20 app upgrade though. Regardless, you will need to copy the app upgrade file to a cd and give that to the person you are selling it to, and have him/her put it in the same directory before they connect their ipod. Other wise, if they have to do a recovery, unless they have this file, the upgrade will be lost.
Here is the path:
~user/Library/iTunes/Mobile Applications/iPod touch App Pack 4A93.ipa