Create a compressed tar file containing all the files ending with .dat in the current directory and name it with the same name as the files but with the extension .tgz.
tar -cvzf $(echo *).tgz $(echo *).dat