An investigation by the state’s attorney general found decades of sex abuse of nearly 1,000 children over a century across three Massachusetts dioceses.