At times a person might feel guilty about his lack of elevated motivations when doing good deeds. But the Sages state that we should engage in Torah study and the fulfillment of good deeds even if we lack pure motivation -- since it will ultimately lead to our doing good deeds with more pure motivation.

Moreover, Rabbi Chaim of Volozhin wrote: It is impossible for a person to reach the level of doing good with entirely pure intentions without starting with mixed motives. This is analogous to a king who ordered his servant to go to the attic. The king will not be angry with his servant for not jumping from the ground to the attic in one leap. He knows it is impossible to go up without taking the ladder step by step.

Similarly, in Torah study and the performing of good deeds, it is necessary to start with various motivations until one reaches pure motivations.