Android 10 has scoped storage which restricts where an app can write to (and read).
On Android 10 (Go) I've found that I can write images (running as SPK and APK) to
GetPrivateFolder() and GetPrivateFolder("Pictures") and GetPrivateFolder("Pictures","External")
FileExists reports that they all save the image.
But the first two are somewhere that File Manager doesn't show.
The latter can be seen in Internal Storage > Android > data > packagename > files > Pictures
(running from Droidscript the packagename is com.smartphoneremote.androidscript
if you build as an APK install and run then it is your packagename).
(ScanFile doesn't seem to add any of them to the Image Gallery, not even after a reboot of Android).