score:19
You might be in a difficult position.
Edited to add: You are most definitely in a difficult position, the original answer below was based on a first reading of your question - I missed the point where you say you have spent 3 years in the UK after entering via the CTA without leave to enter. To compound matters, unless you have been living on savings for that three year period, you have been illegally working. You are at this point an illegal immigrant and are going to find it next to impossible to return to the UK after leaving it now.
I will leave the rest of my previous answer below for future reference.
You entered the UK via Ireland using the Common Travel Area route - as a non-visa national, that would normally grant you 90 days (not six months) legal entry into the UK.
However, you have previously been refused entry, which complicates matters.
The Home Office Guidance for the Common Travel Area, updated in April 2020, has this to say about your situation:
People without leave who have previously been refused leave to enter the UK
A person who has been refused entry and has not since been given leave to enter or remain requires leave to enter. Where you notice such a person arriving in the UK from within the CTA, you must submit them to further examination in the usual way. If you decide to refuse leave to enter, you must give directions for removal either to:
- the place within the CTA from which the passenger arrived
- another appropriate country
If such a person enters without leave and is subsequently noticed, they are an illegal entrant and they may be removed without refusal of leave to enter under paragraph 9 of schedule 2 of the Immigration Act 1971.
It does not sound like you were granted leave to enter (you would know it if you had been - the brief encounter you had with UK immigration in Scotland does not sound like that was what occurred).
Iβd suggest you speak to an immigration solicitor or Citizens Advice to determine what your next steps are.
I doubt that leaving the UK at this point is an issue (as phoog noted in the comments, the UK has no explicit exit checks, but your exit will be noted by UK immigration as they are still informed - your exit, correlated with with no corresponding leave to enter and an outstanding refusal, will all go on record) - returning might be very very difficult indeed, however.