For which command ,i have to store packets in pcap file, ping google.com or traceroute google.com

ping google.com
traceroute google.com

either we have to merge pcap file for both command or what?
and for speciying packets, for which pcap file, i have to note down the packet number?

Understand how tcpdump listens and writes to a pcap file. TIP: Try printing the tcpdump on the terminal first and see what happens for both the commands. Then you will know what to do!

I have tried both, but both command return pcap files, which one pcap files we have to consider.

The right way to do is write a single pcap file for both the commands using a single command that listens to the interfaces. Figure out how this is possible.