The Washington Post Co. has agreed to sell its flagship newspaper to Amazon.com founder and chief executive Jeffrey P. Bezos, ending the Graham family’s stewardship of one of America’s leading news organizations after four generations.