Phoenix,
The preposition "in" can have many, many, different meanings.
The meaning of "in doing" will depend on the meaning of this preposition in the sentecne.
IN can mean....by virtue of, because, on account of.
Examples.
In doing the right thing he will have good karma....On account of doing the right thing.....
You can find happiness in doing simple things. ...By virtue of doing simple things.....
In doing his homework he prepared a solid base for further learning..... Because he did his homework....
IN can mean 'for the purpose of"
He needed help in doing his homework......He needed help for the purpose of doing his homework.
IN can mean "while"
In doing the calculations he made many mistakes.
ETC.