Every motive has an intended effect on the world. When the faculty of desire is what is driving us, we first examine what possibilities the world leaves open, selecting what effect at which we wish to aim. This is not the way acting on the practical law works, though. The only possible object of the practical law is the Good, because the Good is always an appropriate object for the practical law.
We must avoid the danger of understanding the practical law as simply the law that tells us to pursue the good, and instead understand the good as simply that at which the practical law aims. If we did not understand the good in terms of the practical law, we would need some other analysis by which to understand it. The only other option is the mistaken one of understanding the Good as the pursuit of pleasure, and understanding the Evil as acting so as to produce pain for yourself.
We can also fall into believing this confused theory that the good is pleasure by confusing the idea of good versus evil with the idea of good versus bad. The good, as opposed to the bad, is really just pleasure. But the good, meaning the moral good, is not. If a morally good person suffers from a painful disease, his condition is bad (painful), but he is not thereby a bad (evil) person. If a morally bad person is punished for his misdeeds, that is bad for him (painful), but it is also just and good.
The error of all past philosophical investigators of morality is that they have striven to understand the moral in terms of the good rather than vice-versa. In doing so, they also succumb to the error of understanding morality as the pursuit of pleasure, for if one desires the good, one acts in order to satisfy that desire, that is, in order to produce pleasure. Ancient philosophers commit this error openly by seeing ethics as the subject that seeks to define the good, while modern philosophers commit it less openly by defining the right as the pursuit of whatever they see as the good, be that pleasure, obedience to God, or something else.
The moral law is equivalent to the idea of freedom, that is, causation from the noumenal to the phenomenal. The noumenal cannot be sensed, and so moral law can be grasped intellectually but its application cannot be seen. We know, rather, when something is morally right by intellectually considering whether it is coherent that that sort of action could be universally performed.
The idea that we know about what is right and wrong through abstract reflection is called "moral rationalism". It contrasts with two erroneous approaches to knowing the right. The first alternative is "moral empiricism", which takes moral good and evil to be something we can sense in the world. The second alternative is "moral mysticism", which takes sensing the moral to be a matter of sensing a supernatural property, such as whether the action is pleasing in God's eyes. Although both are mistakes and both are potentially harmful, the greater danger lies in moral empiricism. Kant equates moral empiricism with the theory that the right is the pursuit of pleasure, and so sees it as a greater temptation than moral mysticism, which also is less dangerous because it requires its adherents to try to imagine the supernatural, a tiring task that will appeal to few.