The purpose of the attack appears to be for intelligence collection as the hackers might have had access to systems used by the U.S. federal government for court-authorized network wiretapping requests.
It is unclear when the intrusion occurred, but WSJ cites people familiar with the matter, saying that "for months or longer, the hackers might have held access to network infrastructure used to cooperate with lawful U.S. requests for communications data."
Why do the concerns seem to be focused on what data was extracted rather than why there's a massive, state sanctioned civilian surveillance network? I mean, I know the answer, but it's extremely frustrating that people are just fine with intensive surveillance on US citizens from at least 14 countries.
TL;DR: some countries make it unconstitutional to spy on their own citizens. They get around that barrier by spying on eachother's citizens then sharing the info they find.