19
You still don't show us the big picture, but the "syntax error" seems to indicate that you run that from within a SQL client tool (psql, pgAdmin, ...)
pg_dump and psql are commandline programs, not SQL statements.
You need to run them from the command prompt (aka shell)
Additionally the (old db) parameter is completely wrong. The database is not put into brackets for pg_dump, e.g:
pg_dump -U user1 dbname_old_db | psql -U user2 dbname_new_db
Again: you have to run this from the command prompt, not from within a SQL tool