I think it's entirely possible to write while researching. The research might or might not end. A lot depends on your reasons for picking your setting, and on your approach to it.
From what I've seen, historical writers fall roughly into two groups, when it comes to choosing the setting. They choose a particular setting because it's exciting, or popular, or it goes well with some other aspect of the story, or they choose a setting because they are deeply fascinated with it. Both of these approaches are entirely valid, of course.
Writers in the first group are interested in various eras and places and historical figures, and like to change them often. For them the research
does end, because it
must end: they aren't into long-term relationships with their settings. If you are in this group, you'd probably want to do as much research as possible before jumping in. You can research (heh heh) a little bit online and see how those writers do it, how they figure out their topics for research, what kind of sources they use, etc. These writers often work impressively fast and are prolific, and their advice is to prepare well and to narrow your theme as much as possible in order not to get sucked into the rabbit hole of research. For example, if you are writing about, say, intrigue in the court of Catherine the Great, you don't need to research the hell out of the Russo-Turkish Wars just because it might at some point become a topic of conversation for your characters; but you will have to know well who the current favorite of the empress was, and what kind of person they were, and who they were friends or foes with. You must be able to assess what you need, and then write. If you don't know a particular detail in the scene, like the color of the walls or the spices in the food, just [put stuff in square brackets] or something like that, for later, and go. Unless you are
really interested. Unless you feel that you are falling in love with the period. Then you might be ready to settle down, at least temporarily (hur hur).
If you are ready to do that, then yeah, you will be one of those writers for whom research never ends. You will be constantly reading and gathering sources and materials, because you'll feel that you never know enough, and you might become fascinated by the period to the point of being obsessed (but it will feel great!). If you are one of those writers, you might be drawn to historical fiction for the sheer atmosphere and flavor of the period, as well as, and sometimes rather than, the historical events and personages. Then the time comes when you do feel at home in the period to some extent, and then
you might find out that you want to write more than one book set in that period – therefore there's no need to know everything right now, or overstuff the story with all the details you've gathered so far. It's a pretty liberating feeling. Sometimes, when you are truly comfortable in a certain period, you don't need all that much to be able to write something. One-two solid books with good footnotes might be enough, really, to inspire you and let the story grow, if you feel the setting in your bones.
Good luck!
