The Chasam Sofer quotes a Medrash: One sage says, “Shema Yisrael”; this is a great principle of the Torah.
Another sage says, “And you will love Hashem”; this is a great principle of the Torah.
Rabbi Akiva added “And you will love your friend”; this is a great principle of the Torah.
Ben Azai says, “This is the book of the generations of Adam”; this is the great principle of the Torah.
The Chasam Sofer explains: Firstly, the purpose of doing and fulfilling mitzvos is to believe in the unity of Hashem, that He chose us from all the nations and gave us His Torah. If a person does not believe this he denies the basic premise of our faith and all his mitzvos are worthless. Therefore “Shema Yisrael” is a great principle.
But additionally a person should perform mitzvos out of love, like a son to his father, without looking for reward. This is defined by “And you will love Hashem.”
Rabbi Akiva comes to add even mitzvos between men, which are mitzvos dependent on logic, should be performed because Hashem commanded them not just because they make sense. This is what is meant by “Love you friend; I am Hashem” – that your love for your friend should be expressed because Hashem has commanded this.
Ben Azai says, “This is the book of the generations of Adam”. A sefer Torah needs to have lines scored into the parchment so that the writing will not be too high or too low. Similarly, a person has to find the middle ground in his service to Hashem. He should not be too strict nor should he be too lenient. Everything should be in order and settled, straight and true.