After the strategic or financial buyer decides to draft an LOI and proceed with an acquisition of a given target, the purchase agreement will need to be drafted. In the LMM, the investment banker may draft the agreement himself/herself, but as transactions get larger, M&A attorneys will be involved and take the lead with the creation of the purchase agreement. The investment banker will stay actively involved in the drafting of the agreement.
While due diligence is going on, attorneys take boilerplate purchase agreement and modify them to include items of the LOI.
Once due diligence is complete, the purchase agreement should be done for closing.