CoreLogic Inc. agreed to sell itself to two private-equity firms for about $6 billion, a surprising end to an auction of the real-estate-data provider that was kicked off by a pair of shareholder activists.