I must admit I've tended to go the other way i.e taking attachments and moving them to document libraries so they can be properly managed. However yes you can do this.
Two main approaches to implement this, either a custom workflow action or an event handler on the document library. I personally would always go for the event handler approach.
In your event handler you'll need to first get your file with some code like this:
SPFile docFile= docItem.File;
byte fileBinaryData = docFile.OpenBinary();
Then your code the get the last item in your list before you do the following to add the attachment:
Here's a snippet of code I used to test this part to make sure the Attachments command added an attachment to the first item in a list. Please note if you did this before but didn't include the item.Update() then the file is created in the attachments area for the item but not applied to the list item, if you then try and re-add it with the same filename you will get an error.
using (SPSite site = new SPSite("http://sp2013dev/sites/test010/"))
using (SPWeb web = site.RootWeb)
SPList list = web.Lists["Test List"];
Byte fileBinaryData = Encoding.UTF8.GetBytes("Content of file");
SPListItem item = list.GetItemById(1);