Private equity firm Veritas Capital and hedge fund Elliott Management are buying Athenahealth Inc for about $5.7 billion, the U.S. healthcare software maker said on Monday.