Complex sentence: There is a popular temple close to the sacred cities of Tirupati and Tirumala, known as Kapila Theertham according to legend was an ashram of Sage Kapila and that he lived and worshiped Lord Shiva there.
Split into simpler sentences: There is a popular temple close to the sacred cities of Tirupati and Tirumala, known as Kapila Theertham. According to legend, this was an ashram of Sage Kapila and that he lived and worshiped Lord Shiva there.