What makes a loan agreement legal?
Any agreement can be legally binding if it can be proved that a contract was formed. This could be as simple as a party presenting an offer or promise, and another party accepting those terms.
However, verbal or informal agreements are harder to validate in the court of law, as the nature of the arrangement can be easily discredited. For instance, if you make a verbal arrangement with someone with no witnesses around, it becomes your word versus theirs, nearly impossible to prove.
A written agreement signed by both parties has more substantial grounds for validity in legal proceedings and is why we always recommend using contracts.