The cd, gzip and tar commands you posted cannot change file ownership. They do however rely on file/directory access permissions. All they do is unzip/untar an existing file (/tmp/xxinstall/unpack/xxx/linux.tgz) into
a directory called /xxx/mydir.
If you want us to help you debug the script, please post (the relevant piece of) it.
Or alternative, try finding out why the commands you posted fail, starting off by posting the output of
ls -l /tmp/xxinstall/unpack/xxx
ls -ld /xxx/mydir/
Alternatively, you could also try adding 2>/tmp/error.log at the end of the pipe, to get a clue on what goes wrong.