What you need you can pretty much find in the activity AttachEditedFile in Work-
Take into account that the filedata you supply in the FileData parameter needs to be base64encoded. This can be done using the Base64Encode function.
How the attachment category is set is a bit weird, the activity both asks for a category by input parameter as well as the name of an attachmentpage. The parameter value is overwritten by the value on the attachmentpage. Be aware of that.