Thanks for your valuable inputs. I partly agree with both of you. In fact, I planned my way up to this point exactly as @boneh3ad said to try to prove myself that I can -
a) get good grades.
b) finish research.
But recently I have also seen opinions like what @xraymancs said that if PhD is the end goal, doing a thesis in my masters can be a waste of my time.
I know there is no clear route to it. It also depends on the PhD program and the particular professor.
Anyway, thanks again!