Can anyone please explain how I should use gerunds In those sentences?
Subhajit, you say "how I should use gerunds." The point is that sometimes you don't need to use a gerund, or any kind of word in particular, if you want to sound natural. Language does not work that way, enabling the use of any category of word at all times.
Before finishing the project, you need to finish your homework.
Before your finishing the project, you need to finish your homework.
When the (implicit) subject of the gerund is the same as that of the main clause, it is incorrect, or in the best case extremely awkward, to use the possessive as in your second sentence above. Why should you use it?
- John there's a good show going on the TV on career making. Watch It before Its ending.
In this other case (please note it is incorrect to capitalize "it" and "its"), I'd say the gerund is incorrect. One would use the noun phrase "the end" (though the meaning would be different from the one you intended) or, as you said, the clause "it ends." Even the noun phrase "its end" would sound very strange, if not altogether wrong.