passing variable values to procedure in postgresql via psql
That won't work, because the $$ that surround the body of your DO statement delimit a string literal, just like single quotes. And psql won't interpolate variables in a string literal.
You should write a PL/pgSQL function and pass the variable as argument in the function call.  If you need the function only temporarily, you can use the undocumented feature of a temporary function: create the function in schema pg_temp, and it will vanish automatically when your database session ends.