Billionaire entrepreneur Elon Musk agreed to buy Twitter Inc. for $44 billion, using one of the biggest leveraged buyout deals in history to take private a 16-year-old social networking platform that has become a hub of public discourse and a flashpoint in the debate over online free speech.