This is a licensing matter: each verb “licenses” or permits only specific kinds of clausal complement. The verb finish licenses gerund clauses but not infinitive or that clauses:
okSalman finished writing two compositions.
∗ Salman finished to write two compositions.
∗ Salman finished that he wrote two compositions.
By contrast, begin licenses both gerund and infinitive clauses:
okSalman began writing two compositions.
okSalman began to write two compositions.
∗ Salman began that he wrote two compositions.
Linguists have strained for a couple of generations to discern a “logic or rule” behind specific licenses, but I have not seen a convincing account. It’s just an idiomatic property of individual words, and you have to learn it word-by-word.
Click this licensing to see more questions involving licensing by verbs and words of other classes.
∗ marks an utterance as unacceptable