You need a co-ownership agreement or similar document which is a legal contract that outlines the terms of the arrangement, including how the property will be owned, how costs will be shared, and what happens if a co-buyer wants to sell their share or passes away. You will also need to consider how you want the mortgage to be set up: either as joint tenants or tenants in common.