Walgreens disclosed Thursday that it agreed to be acquired by Sycamore Partners, a private equity firm, for $23.7 billion.