There are lots of fixed expressions in English that go with the -ing form of the verb (gerund).
If a preposition (in/on/at, etc.) is followed by a verb, then the verb is put into its gerund (-ing) form.
You can also use the -ing form of the verb in the following cases:
Before – ing and after – ing
Here you can also say;
by + ing to answer the question “how”
Without – ing to talk about something that did not or should not happen.
The tricky “to”
“to” marks the infinitive form of the verb, but it can also be a preposition.
When “to” is a preposition, then you use the -ing form after it.