Here the "heart" represents the feelings and desires. Being completely devoted and obedient to God is spoken of as having a clean heart. Alternate translation: "Make me completely devoted to you" or "Make me want to obey you always" (See: [[rc://en/ta/man/jit/figs-metonymy]] and [[rc://en/ta/man/jit/figs-metaphor]])
Here "spirit" represents the attitude and desires of a David. Alternate translation: "make my attitude right" or "make me always want to do what is right" (See: [[rc://en/ta/man/jit/figs-metonymy]])