When you get an attachment in Mail, the usual way to move it to a folder is via the Save button in the message or a control-click and then choose Save (or you can drag it into a Finder window). Either of these methods brings up a Finder window from which you can mouse around to put it where you want.
But if you are already working in a Terminal window in the directory where you want to save the attachment, type 'cp ' (note the space), then drag the attachment to the Terminal window and drop it there. Finally, type a period. When you're done, your Terminal window will look something like this:
cp /private/var/tmp/folders.501/TemporaryItems
/com.apple.mail.drag-T0x40a280.tmp.1L2mdM/filename.txt .
Press Return and, voila!, your attachment is copied.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061219190646132