Law is a set of laws and rules that govern the life of society. To answer this question, why does a person need this, it is worth asking another question: what are traffic lights for? And any sane person (especially if he is a resident of a large city) will confidently answer: in order to regulate traffic! After all, without them there will be constant accidents and casualties. This is the main function of law: regulation of the daily life of the state and the population by establishing norms and laws.
All people are different. Each person has his own unique character, habits, needs, views, beliefs. And such is human nature that he considers them the most correct, useful and natural. Therefore, the habits and needs of one person can easily lead him to conflict with another person who for some reason does not like them. That is why we need clear and understandable rules that are binding on all citizens of the state. So that each person clearly knows and understands which behavior is acceptable and which is not. What he can do, and what is already an offense and will entail administrative or even criminal liability. Another most important function of law is to protect the legitimate interests of citizens. If they are violated as a result of someone's criminal encroachments or abuse of authority by some officials, the citizen should be able to resort to the protection of the law (by contacting the prosecutor's office or the court). Accordingly, simultaneously with the protection of the victim, the law must punish the violator. That is why the law establishes clear criteria: what sanctions are imposed for the commission of certain unlawful actions. Of course, one can argue that all this is good in theory, but in practice, alas, it often turns out in accordance with the bitter saying: “The law is what a drawbar, where you turn - there you go”. What can I say? Yes, unfortunately, not a single country in the world guarantees that the right will be impeccably observed. But such a right is better than none. World history has recorded many cases when attempts were made to abandon both the state and the laws altogether, building an ideal society of "complete freedom." But no matter what the people were guided by, considering any state to be bad and any right to be violence, their ideas and their attempts failed completely. The famous slogan "Anarchy is the mother of order!" showed its complete failure. Maybe sometime, in the distant future, people will learn to live in a society of "complete freedom". In the meantime, such attempts only lead to complete chaos and monstrous abuse. The consequences are easy to imagine. So it's better to live in a society where there is a right.