Sanskrit was borrowed from संस्कृत saṃskr̥ta "put together, well-formed", from sam "together" and kr̥ "to make".
kr̥ is from Proto-Indo-European *kʷer- "to make".
sam is from Proto-Indo-European *sem- "one, together with". The zero-grade form *sm̥- combined with the adjectival suffix of comparative *-tero- to form *sm̥-tero-, becoming Greek ἕτερος heteros (earlier hateros) "one of two, other". This was borrowed as the English suffix hetero- as in heterogeneous, heterosexual.
And the o-grade form *som- became Greek ὁμός homos "one and the same", borrowed as English homo- as in homogeneous, homosexual.