DirecTV is buying Dish and Sling as the company, a deal it has sought to complete for years, as it seeks to better compete against streaming services that have become dominant.