Run a list of commands in a script
Quoted Spaces
A couple of lines need quoting to deal with spaces:
pkill Microsoft Teams

Should read:
pkill &quot;Microsoft Teams&quot;

and Local Storage needs a slash to become Local\ Storage.
Absolute Paths
If you continue to encounter problems, try expanding the ~ and use absolute/full paths. This can solve many problems and allows scripts to be run from within other tools like cron or launchd.
ShellCheck
A useful tool to know about is ShellCheck. This online or offline tool can help point out common shell script problems.