Rosemary is notorious for being difficult to start. It likes moist but well-drained soil, hates wet feet, and doesn’t like sudden temperature changes such as what happens when you bring it in from outside.
Good luck! It’s one of my favorite seasonings, and I’ve never gotten it to survive more than a couple of months.
/johnny