Put the output from a dialog box into a bash variable:
termux-dialog outputs data in json format so we need to parse that. One way is to use jq which needs to be installed: apt install jq -y
Then because we're going to pipe the output into jq we'll need to enclose everything in double quotes before assiging to a variable. This is is a good example:
myvariable="$(termux-dialog -t "Please enter some text" | jq '.text' -r)"