tailmust to read the whole file. Callingsortwith a-r(aka--reverseoption) you can useheadinstead.touchtakes multiple arguments. You maytouch $DIRNAME/first.txt $DIRNAME/second.txt $DIRNAME/third.jsonand further use brace expansion:
touch $DIRNAME/{first.txt,second.txt,third.json}I would consider here-documenting the json files instead of echoing them, along the lines of:
cat <<< EOF >> $DIRNAME/test.json { "enabled": true } EOF