The particles also have potential energy due to intermolecular attractions.
Energy is transferred from one particle to another during collisions, but at constant temperature the total energy of the system is constant.
Potential energy results from attractions of particles for each other. That is, particles under the influence of gravitational or electrical forces possess potential energy.
Atoms in molecules possess potential energy because they are attracted to each other. Potential energy leads to cohesive forces in matters, which bring particles together, forming liquids and solids.