Was looking at doing something similar my only thoughts as to where you are is that CaSSAndRA needs (I think) to be stopped at the beginning of the script and and restarted after the update which is what I was doing
#!/bin/bash
# Script to update CaSSAndRA
# needs to have sudo power to stop and restart so sudo password is needed
# Assume script is run from home directory
cd
echo "Pleae enter your sudo password"
read PASS
echo "$PASS" | sudo -S systemctl stop cassandra
mkdir -p CaSSAndRA_BU
cp -R CaSSAndRA/CaSSAndRA/src/data CaSSAndRA_BU/
# Do update stuff
echo "$PW" | sudo -S systemctl start cassandra
exit 0
Probably make Linux purists spin in their graves but it seems to work