Finding the file that's modified when you run a terminal command?
In general, you can use ‘opensnoop’ which will list files being accessed in realtime. You'll need to disable SIP to use this command.

sudo opensnoop


To use opensnoop on a specific process such as osascript, use

sudo opensnoop -n osascript


For that specific command, no file is modified. It's setting the current volume, that's all.