Carlyle Group Inc. sold a troubled loan it provided to iRobot Corp. less than three years ago as the maker of Roomba vacuum cleaners is trying to stave off a potential bankruptcy filing.