The path Descartes followed from the "discovery" of the "first truth" : cogito, ergo sum to the existence of the self, God and the external world was a complex one, made of all the six Meditations, with a lot of subtle arguments :
The cogito raises numerous philosophical questions and has generated an enormous literature.
You must follow this path at least trough the relevant SEP entries : Descartes' Ontological Argument
and Descartes' Epistemology
:
Descartes' reference to an “I”, in the “I think”, is not intended to presuppose the existence of a substantial self. In the very next sentence following the initial statement of the cogito, the meditator says: “But I do not yet have a sufficient understanding of what this ‘I’ is, that now necessarily exists” (Med. 2, AT 7:25). The cogito purports to yield certainty that I exist insofar as I am a thinking thing, whatever that turns out to be.
In the final analysis, Descartes thinks he shows that the occurrence of thought depends (ontologically) on the existence of a substantial self — to wit, on the existence of an infinite substance, namely God (cf. Med. 3, AT 7:48ff). But Descartes denies that an acceptance of these ontological matters is epistemically prior to the cogito: [...].
If the cogito does not presuppose a substantial self, what then is the epistemic basis for injecting the “I” into the “I think”? Some critics have complained that, in referring to the “I”, Descartes begs the question by presupposing what he means to establish in the “I exist.” Among the critics, Bertrand Russell objects that “the word ‘I’ is really illegitimate”; that Descartes should have, instead, stated “his ultimate premiss in the form ‘there are thoughts’.” Russell adds that “the word ‘I’ is grammatically convenient, but does not describe a datum.” Accordingly, “there is pain” and “I am in pain” have different contents, and Descartes is entitled only to the former.
But note that :
As the canonical formulation has it, I think therefore I am. (Latin: cogito ergo sum; French: je pense, donc je suis.) This formulation does not expressly arise in the Meditations.