Praise be to Allah.
What is required of everyone who enters ihram for ‘Umrah or Hajj is to complete the rituals, regardless of whether he started an obligatory or supererogatory (naafil) pilgrimage, because Allah, may He be exalted, says (interpretation of the meaning): “And perform properly (i.e. all the ceremonies according to the ways of Prophet Muhammad blessings and peace of Allah be upon him), the Hajj and Umrah (i.e. the pilgrimage to Makkah) for Allah” [al-Baqarah 2:196].
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If a person begins Hajj or ‘Umrah, it is not permissible for him to stop it unless he has an excuse that prevents him from completing the rituals, because Allah, may He be exalted, says (interpretation of the meaning): “And perform properly (i.e. all the ceremonies according to the ways of Prophet Muhammad blessings and peace of Allah be upon him), the Hajj and Umrah (i.e. the pilgrimage to Makkah) for Allah . But if you are prevented (from completing them), sacrifice a Hady (animal, i.e. a sheep, a cow, or a camel, etc.) such as you can afford” [al-Baqarah 2:196]. “But if you are prevented” means: if you are prevented from completing the rituals.
End quote from Majmoo‘ Fataawa Ibn ‘Uthaymeen (23/438)
Losing your colleagues during Hajj does not come under the heading of being prevented, because you could have completed the rituals without them. What you should have done, once you had decided to do Hajj, was to learn its rulings, especially since you are one of the residents of Makkah and it would not have been difficult for you to learn the rituals before starting it, or to ask about how to complete them after having started.
What you have to do now is the following:
Repent to Allah for having fallen short in performing the rituals in the proper manner because of not having learnt about the religion even though the means of learning were readily available to you.
As you were either doing ifraad (Hajj on its own) or qiraann (Hajj along with ‘Umrah), as appears to be the case from your question, and because the people of Makkah cannot do tamattu‘ (‘umrah followed by Hajj, exiting ihram in between), then there still remains for you to do the pillars or essential parts of Hajj, namely tawaaf al-ifaadah and the sa‘i of Hajj. These essential parts are not waived under any circumstances. Based on that, it is essential for you to do them no matter how long a time has elapsed.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Tawaaf al-ifaadah is one of the pillars or essential parts of Hajj, without which Hajj is not complete. If a person omits it, then his Hajj is not complete and it is essential for him to do it. So he should go back, even if he is in his own country, and do tawaaf al-ifaadah. In this case, so long as he has not yet done that tawaaf, it is not permissible for him to be intimate with his wife, because he has not yet exited completely from his ihram (i.e., the second stage of exiting ihram). That is because he has not exited completely from his ihram until he has done tawaaf al-ifaadah and sa‘i, if he is doing tamattu‘, or if he is doing qiraan or ifraad, but he did not do sa‘i with tawaaf al-qudoom.
End quote from Fataawa Arkaan al-Islam (p. 541)
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: I am one of the residents of Makkah. I did Hajj last year and I did tawaaf, but I did not do sa‘i. What is the ruling?
You have to do sa‘i, and this was an error on your part. It is essential to do sa‘i, regardless of whether you are a resident of Makkah or otherwise. It is essential to do sa‘i following tawaaf after coming down from ‘Arafah; you have to do tawaaf and sa‘i. The one who omitted sa‘i must do sa‘i now.
End quote from Fataawa ash-Shaykh Ibn Baaz (17/341)
You have to offer compensation for the obligatory acts that you omitted until the time for them was over by offering a sacrifice. These acts are: stoning the Jamaraat, staying overnight in Mina during the nights of at-Tashreeq, and offering a sacrifice if your Hajj was qiraan.
As to whether shaving the head or cutting the hair are also included in that, so that you have to do offer a sacrifice, or that is not the case, so you do not have to do that, this is a matter concerning which the scholars (may Allah have mercy on them) differed:
The Hanafis, Maalikis and Hanbalis – according to one report – are of the view that if a person delays shaving his head until the days of sacrifice are over, he has to offer a sacrifice to make up for that delay.
The Shaafa‘is, and the Hanbalis according to another report, are of the view that if he delays shaving his head until the days of tashreeq are over, he does not have to do anything, but any time he does it, it is acceptable, like tawaaf al-ifaadah and sa‘i. The Shaafa‘is stated that it is makrooh to delay it.
See: al-Mawsoo‘ah al-Fiqhiyyah (10/12-13)
The first view, which is that it is obligatory to offer a sacrifice, was mentioned in fatwas by Shaykh Ibn ‘Uthaymeen. He (may Allah have mercy on him) was asked: A man did ‘Umrah or Hajj, but when shaving his head, he did not shave all of his hair. Several years have passed since his Hajj or ‘Umrah. What is the ruling on that? We would also like to have a guideline on when the pilgrim doing Hajj or ‘Umrah should be instructed, if he has omitted any of the rituals, to go back to Makkah and do them.
He replied: This man has omitted an obligatory act, and omission of obligatory acts requires a fidyah (ransom), which is a sacrifice that should be slaughtered in Makkah and the meat distributed to the poor. Thus his Hajj will become complete.
With regard to things that the pilgrim must make up if he failed to do them, these are the pillars or essential parts of Hajj. As for obligatory acts, if the time for them has ended, he should make up for that by offering a sacrifice.
End quote from Majmoo‘ Fataawa Ibn ‘Uthaymeen (22/481)
With regard to the prohibited acts that you have committed, such as having intercourse before completing your rituals, you do not have to do anything, because what appears to be the case is that you only did that because you were unaware of the ruling.
To sum up:
As well as repenting, you have to hasten to complete your rituals by doing the essential parts that still remain, namely tawaaf al-ifaadah and sa‘i of Hajj. You also have to offer three sacrifices to be slaughtered in the sanctuary and the meat distributed to the poor there, to make up for the obligatory acts that you omitted, namely shaving the head, stoning the Jamaraat and staying overnight in Mina. You should also offer a fourth sacrifice, namely the hadiy if you were doing qiraan. If you cannot afford to do that then you must fast for ten days.
And Allah knows best.