I’m not sure what you’re trying to do, but I’d setup an SFTP server and have your application save documents in there. You could have some script on the receiving system monitoring the SFTP folder to move incoming files to some preferred location when necessary. Check out the SFTP module in the market place.
You can create folder using
File f1 = new File(path);
Where are you deploying? Because this will never work in the cloud. In the Mendix cloud you can only read and write to the path you can retrieve with com.mendix.cor.conf, Interface Configuration, method getResourcesPath():
See also documentation here: https://docs.mendix.com/addons/apd-addon/ig-one-java-security-settings