Nobody can tell you anything. It's in no way clear what you are actually trying to achieve. you have not provided any proper explanation nor any useful info like version of AE, System info, details about the comp or screenshots even.
I have a video of me throwing a grenade and i have a video of an explosion but a part of door is covering the room where i threw the grenade so i am masking the explosion,but the video is shaky the camera is moving so everytime i mask it the mask keeps moving and then the video overlaps.I tried to create a solid and mask on the solid and then used trkmatte on the explosion video but the mask kept moving?Im using After Effects CC 2015.
Do you mean the mask is moving in relation to the video or in relation to the composition?
Could you show us an example? Stills dropped into the reply box here or video uploaded and linked here will work.
To do what you are trying to do requires an understanding of tracking, stabilizing the shot in some way or tracking the camera motion, then doing the Roto, then putting motion in the explosion or tracking the camera motion, then doing the Roto, then putting motion in the explosion, then refining the edges and completing the composite.