If I understand your question correctly, the rule is fairly simple.
For example, take the word 'run.' In this case, we double the consonant 'n,' when adding ing, for example. Thus, the word 'run' becomes 'running.' It's important to note that only single consonants are doubled when adding ing. We do not add a third consonant when the word already ends in a double consonant. Thus, 'think' becomes 'thinking' just by adding ing. We would not add any extra consonants.
The most important thing to remember is that English has many rules because it's the largest language in the world. But, the rules are guides. There are always exceptions.