You will also need android permissions to write to “external storage” i.e. the phone’s documents
This topic recently covered some of that, hard to follow because of the huge code pastes and little else information. But they claim to get this path to work: "/storage/emulated/0/Pictures/Drawing/" + filename