I used this technique recently to form a new habit of meditation. This is the process I followed:
1 ) Determine the existing long term activity (activity that I have been doing daily for months/years) that either fullfills my curiosity or makes me happy/relaxed. E.g. Checking messages right after waking up, Eating food, Watching movie/tv show, talking to friends etc.
2 ) For 21 days, do the new activity related to new habit before an activity from step 1. E.g. In my case, I started doing meditation before eating breakfast. This needs to be done in 5 sets, so that is 21 x 5 = 100. Remember, we are not doing it for 100 days continously. After every 21 days we can take a break for a day or two.
3 ) Tell yourself everyday that, "I am actually enjoying the new activity from within. It is helping me reach nearer to my goal everyday. Therefore, I am going to do it today before I start [ACTIVITY_1]." E.g. I tell myself "Meditation is fantastic because it is helping me remain calm. Therefore I am going to do it today before having breakfast. My 🍲️ breakfast is awaiting ❤️ "