How can I get the thermal conductivity after the above step? I know It already gives the trajectory data (trajs_T300.traj) for each temperature. However, I am looking for the exact script or code to get the thermal conductivity.

Also, can we use the hiphive force-constant potential in LAMMPS to get the thermal conductivity? If yes, please suggest or give some hints.

I dont think you can get the thermal conductivity directly from a trajectory .traj produced by that example.

You can use force-constants to calculate the thermal conductivity via BTE using codes like phono3py, kaldo etc. You can also use force-constants to run MD and calculate the thermal conductivity via e.g. Green-Kubo (GK). The latter is probably much more difficult and time consuming.

I am trying to get the thermal conductivity using GPUMD. I was trying to generate the NEP potential for my system. I found a large mismatch between train and test forces. I get the train.xyz from the OUTCARs that I have used in hiphive from rattle structure generation. For the test structure, I used my previous calculation (structure from thirdorder.py in ShengBTE) and found a large force mismatch. Am I using the wrong test structure? If yes, how can we get the test structures?

How to train a NEP is not related to hiphive.
If you want to do this, which is different from your question above regarding thermal conductivity with force constants, then i would not use structures from thirdorder.py, but instead look into papers using NEPs and how they generate training structures.