“Quit” (and “stop”, etc.) can be used with the gerund and / or the infinitive, but the meaning is entirely different.
Here’s an example with both:
“Joe quit studying French to study German.” The meaning is that Joe was studying French, but he stopped — he is not studying French any more. He stopped studying French in order to study German (which he may still be studying now). Here is another example: “Mary quit (or “stopped”) running to tie her shoe.” In such sentences, either phrase can be used separately: “she quit running” or “she quit to tie her shoe”. Note that the meaning is completely different.