Rails are made up of steel and they will undergo thermal expansion in the summer season.
If there is no space between railway lines for accommodating this expansion, then the railway lines will bend outwards and it will lead to the derailment of trains.
To avoid derailment of trains due to the thermal expansion of rails, small gaps are left between the railway lines.