In the beginning of this weeks Parsha, the Torah instructs the nation to appoint judges and police. to judge the nation properly, not to show favor in judgement or take bribes. Then in 16:20 it continues by saying, "Seek out righteousness so that you will live and inherit the land that Hashem has given to you."
The question is, and it is asked by many, what is the connection between judging righteously and inheriting the land?
Rashi, with the help of the explanation of te Sifsei Chachamiim, explains that ,"So you will ive and inherit the land" is not referring to the Seek out righteousness statement, rather it is going back on the appoint judges to judge properly and not take bribes. if you appoint such judges they will be worthy of bringing the nation to inherit and live in the Land of Israel.
I think that it is all one continuous flow of pesukim, and there is no need to relate this part back to the previous passuk.
If the judges act righteously and do not take bribes, there will be a sense of morality among the people. When the leaders are righteous it filters down to the regular people. They too will seek out to live righteously. When everybody is living properly with the proper moral and ethical codes, then the nation will be worthy of inheriting the Land of Israel.