Q: How do I get my flock to go into their coop at night so I can shut the door and make sure they're safe?
A: Once they have imprinted on their coop as "home," they will retire on their own at dusk. (Thus the saying: "Chickens always return home to roost.")
You can get your birds to regard the coop as home by keeping them inside it for a few days after you have transferred them from the chick brooder. They will get used to sleeping there and will feel safe returning there at night. Naturally, you will want to make sure you don't keep them shut inside a hot coop in the dead heat of summer when they may get overheated--don't make the transfer during extreme weather, and remember that a shut building can get very hot during the day. be mindful of the needs of your flock. That said, when they learn that the coop is "home" you won't have to make them go in at night at all. They will do it on their own, and you can just shut the door behind them--voila!
And that's good news, since chickens can be hard to herd!