You can save the file in the NSDocumentsDirectory (getApplicationDocumentsDirectory()) and then make it available to the user.
From: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
Use this directory to store user-generated content. The contents of this directory can be made available to the user through file sharing; therefore, his directory should only contain files that you may wish to expose to the user.
To make the directory available to the user you need to open the Xcode project under ‘your_app/ios/Runner.xcworkspace’. Then open the Info.plist file in the Runner directory and add two rows with the key UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace. Set the value of both keys to YES.
If you now open the Files app and click on ‘On My iPhone’ you should see a folder with the name of your application.