I read about rajpurohit that they are rajgurus of the king in the kingdom but I'm not sure about this position. So who are the Rajpurohits and were Guru Dronacharya and Kripacharya the Rajpurohits of Hastinapur?
The term 'Rajpurohit' basically means 'Royal Priest', which is priest of the royal family, so in other words priest of the king and the kingdom.
Bhishma gave willing consent to this condition. Thereafter Drona abode with his wife in the royal palace, and his son Ashwatthama was trained with the Pandavas and Kauravas. He became the family priest as well as the instructor of the princes. And ere long the young men were accomplished warriors, and deeply learned in wisdom and in goodness.
Kripa as royal priest as stated below:
Great Duryodhan midst the princes stands alone without a peer, Kripa priest of royal Kurus, holiest of all priests is here!
As stated in Devi Bhagavatam about Rishi Vashishtha being a royal priest:
32-35. The King said :-- “O Bhagavân! You have described the cause why the King Nimi was cursed; my mind has grown very doubtful and restless on hearing it. The Risi Vas’istha was the son of Brahmâ and the best of the Brâhmins; especially he was the royal priest; how was it, then, that he was cursed by the King! Why did not the King Nimi forgive him as he was the Guru and a Brâhmin? Why he became angry, when he performed such a great, auspicious sacrifice? He was born of the family of Iksâku and he knew well the truths of the religion; then how was it that he became subject to anger and cursed his own Guru Brâhmin.”
Also citing reference from Astika Parva:
"And when the king was laid low by Takshaka's poison, his councillors with the royal priest--a holy Brahmana--performed all his last rites.
Found an article as well on this topic worth sharing as it is related to your question:
Rajpurohit is a subgroup of Hindu Brahmins, they are considered as the oldest brahmins who where associated with the ruling class of a kingdom since ancient ages in india. As a tradition Rajpurohits were not only involved in heading the religious rites and duties but also provide selfless service to the state, they were considered to be guardians of the state. They were as much into mentoring royal house, educating princes, guiding king on the path of dharma, providing advise on the matters of welfare of the state, performing religious duties as they were into helping in maintaining the security of kingdom by being actively involved in battles. Guru Dronacharya and Kripacharya were the Rajpurohits of the ancient kingdom of Hastinapur who participated in the great war of Mahabharata on behalf of the state during fall of the Dvapara Yuga.