The FileDocuement/Name is the filename of that document. So when creating a filedocument from within Mendix (see the documentation: https://world.mendix.com/display/refguide5/Generate%20Document you can use this document to pass to the SFTP module. There you can store the filedocument on a SFTP server. In the SFTP server configuration you can define the path where to store the document on the server, so you can choose different directories for instance for different type of documents.
Otherwise the path does not make sense. A filedocument either gets downloaded or is shown in the browser (depending on the setting). Hope this helps.
You can only set the attributes that aren't connected to the binary data of the file. However using the community commons function texttofile you would be able to save your test contents to your newly created FileDocument object.
On creation of that FileDocument object, you can give it a name. And then commit it to save the file to disk (if the community commons function doesn't already take care of that).
Afterwards, you can use the (S)FTP module to send it to the server of choice.