Habits are formed by repeated conscious actions so that they become unconscious actions. It is only through practice, through hours and hours of doing the actions, deliberately and focused that you form these behaviors. In other words, you must spend the time initially and consciously focused on doing the action so that after hours, days, months, and ever years, that action is now second nature.
It does not matter whether the behavior is good or bad; it just matters that you do it and you do it over and over and over again. This is how a habit is formed. In other words, it is through relentless execution that habits are formed.
Now be mindful to do, to execute, the right actions, the desired actions, which will lead you to your desire goal; because once a bad or wrong habit is developed, it is hard to eliminate.