ועשית הישר והטוב בעיני הי.
-You shall do that which is right and good in the sight of G-d. -Deuteronomy 6:18
The verse doesn't provide any additional insight to what that should mean. It's more of an ethical declaration that leaves more to be desired. How do we determine what is right and good? What does this verse even mean?
One can view it as a continuation of Deuteronomy 6:17, which says that one should observe the commandments. With this interpretation, Deuteronomy 6:18 is a theological clarification of the previous.
For Rashi, the verse means that we should go beyond the letter of the law, particularly with compromising with an opponent [in a court of law]. For Rashi, Deuteronomy was not a clarification of the previous verse, but rather a new category of behavior. The Talmud (Bava Metzia 16b) seems to support Rashi's argument in that it says that the word ישר means having the obligation to do something correct, even though not obligatory.
If they are indeed two different categories of "the letter of the law" and "beyond the letter of the law," G-d should have just told us to go beyond the letter of the law since that is what He ultimately wants from us. However, G-d gives us both. I think G-d did so for two reasons. The first is that without explicit commandments, we would not have a baseline for proper behavior. This would result in moral relativism and decay. Plus, Judaism is very much about the practical, and needs concrete examples to help guide a proper way of life. This leads into my second reason. Legal minima provide us with a clear line, whereas going beyond that puts us on a different playing field. As Ramban says, there are so many examples that the Torah could not list all the examples in our interpersonal lives in which we can implement the concept. It is why "do right and good in the eyes of G-d" is presented in such general terms.
My third reason is that G-d wants us to do better. G-d wants us to be the best people that we can be. In order to improve, we need to accept ourselves as we currently are and go from there. We cannot view ourselves in abstraction or in ideal form. There are going to be certain mitzvahs in which we excel, and certain mitzvahs in which we can improve. While we are supposed to aim high, there are times in which all we can do is the minimum, and even that minimum can be a challenge at times. By creating both categories, G-d provides us with both categories as a more personalized and realistic framework for improving upon ourselves and bringing holiness in every aspect of our lives. In Bava Metzia 30b, the Rabbis said that Jerusalem was destroyed because we only observed the letter of the law. The Rizhiner Rebbe said there was a fifth book of the Shulchan Aruch. While there technically is not such publication, the Rizhiner Rebbe nevertheless said that there is: it's called being a mensch, which is what it means to "do right and good in G-d's eyes." Especially right after Tisha B'Av, let this be an inspiration to not only follow the mitzvahs, but to go beyond the letter of the law and embody the spirit of the law in everything we do.