You’re creating a System.FileDocument object and you can’t download that. You should create a specialization in one of your module domain models and assign access privileges. See also https://docs.mendix.com/howto/data-models/working-with-images-and-files#4-file-documents, steps 4.1 – 4.5.