The Prophet Muhammad (SAWA) never allowed Muslims to divide in to groups or sects. Sects were formed long time after the Prophet (SAWA). Muslims were ordered by the Prophet to keep following Quran and Ahlul Bayt. Political reasons and wrong rulers caused many Muslims to be away from Ahlul Bayt (AS) and follow different sects.
Mu'awiyah ibn Abi Sufyan announced the year 41 after Hijra when he became the top ruler on Muslims after his treaty with Imam Hasan (AS) as the year of Jamaa'ah عام الجماعة .
He ordered all his appointed Shaikhs on pulpits and sermons to curse Ameerul Mo'mineen Ali (AS). This evil habit continued for many generations till the rule of Omar Ibn Abdul Aziz who ordered to remove the curse. Many of Mo'awiyah followers did not like to leave cursing Ali and called it Sunnah and shouted demanding the continuation of the curse being part of the Sunnah. أين السنة؟ Where is the Sunnah?
The title of Ahl al-Sunnah was used by extreme Sunni Hanbali Muslims even during their fights with other Sunni sects like the dispute between followers Abu Hanifah and Ibn Hanbal. Abu Hanifah school was called Ahlul Ra'y ( people of opinion) by Hanbalis and other Sunni sects.
The term Ahlul Sunnah wal Jama'ah was used during Abbasid government for and by those Muslims who do not follow Ahlul Bayt (AS) even if the show love and respect to them, but follow other sects.
We have Hadeeths from Ahlul Bayt (SS) stating: By Allah, no one is following the real Sunnah and unity of the Ummah but we and our followers
والله ليس على السنة والجماعة أحدٍ الا ٫نحنوشيعتنا