How does the script work?

To begin with it might be useful to know that dcraw really only uses 2 of the options available (feel free to code in a few more if you need them)
-r to specify the white balance parameters
-c to send the output to the standard output (so that it can be fed into Imagemagick)

The Anatomy of the Imagemagick Command-line

The ImageMagick command-line consists of
one or more required input filenames.
zero, one, or more image settings.
zero, one, or more image operators.
zero, one, or more image sequence operators.
zero, one, or more image stacks.
zero or one output image filenames (required by magick, convert, composite, montage, compare, import, conjure).

The script uses the termux file requester to ask for the RAW image to process & then asks for the files that hold the preferences. The selected file is the copied to a file in the same directory, where it acts as the input into the image processing. If there is no request to select a file then that input file remains in place as the default processing instruction for subsequent runs.

There have been some practical/evolution decisions about the files that are used/requested. It would be possible to specify the parameters as settings files holding multiple operations within them, but that also needs a lot of work to test the best setting for a single changed parameter (which you could manage with a softlink "alias" that used set & the single parameter that you want to test/change in its name.

Once the (default) parameters have been set they are read into a set of bash arrays. These hold the settings, in a set of "chunks" that can be passed as instructions. They don't need the quote marks that you might have to enter if you were doing this "longhand" & if the array is empty then it adds nothing to the command (i.e. it's ignored).

Then all that's needed is to ask for a file name for the processed file (not check about overwriting!) & then the script creates & runs the command line to process the RAW file & run imagemagick with the settings loaded from the default files.

There is nothing to stop you from adding extra commands into the settings files, but do read the link above, which goes through the extensive list of options & spells out the order in which things are applied & how that matters.