People buying a house together risk losing their investment if they don’t seek legal advice first, according to the Law Society.