Complex sentence: On hearing the desire of Kavirayar, they were shocked and to escape from him they told him that if Kavirayar would build a dam across the river Thamiraparani before the sunrise then they would marry him.
Split into simpler sentences: On hearing the desire of Kavirayar, they were shocked. To escape from him they told him that if Kavirayar would build a dam across the river Thamiraparani before the sunrise then they would marry him.