Set the result of command to variable in Terminal post execution
What if you used a function defined in one of your bash startup file?

getvmid () {
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage list vms | grep $1 | cut -f 2 -d { | cut -f 1 -d }
}


The $1 is the first parameter of the function. It also limits the scope of the variable.

getvmid Fred


Setting the variable:

vm=$(getvmid Fred)


Untested but this should also work:

vbm control "$(getvmid Fred)" poweroff