i have the script how to write script in compress format in tar
What you qare asking does not make a lot of sense - this will make a tiny tatball out of a shell script:
tar cvf myscript.tar myscript.sh
gzip myscript.tar
The output is myscript.tar.gz