Hello, I think you are with a version dolibarr version 21.0.1~ynh4 and there is a little step to correct, here the explanation
first correct this file on line 20
nano -l /etc/yunohost/apps/dolibarr/scripts/backup
line 20 to correct like this :
# Check if the group is set
if [ -z "${syncyunohost_main_group:-}" ]; then
To keep the edited changes Ctrl + O and Enter, then Ctlr + X to leave editor nano.
Then the upgrade should works, it needs first have a backup working.
Sorry for the inconvenience…