All metals expand when heated(Thermal expansion). If two railway tracks are laid together without any gap between them they will push against each other when they expand in the day time because of the heat of the sun, and when they cool down in the night they will contract and return to their original state pulling against each other. This constant pushing and pulling against one another when they heat and expand in the day time and cool down and contract in the night will result in the weakening of the joints between the two tracks and after a few days the two tracks may also break free from one another. Such a situation will result in the derailment of the trains causing major accidents and loss of lives.