When concluding the writing of a Sefer Torah at the start of a Hachnassas Sefer Torah, do the last letters need to be filled in before shkiah (sunset) or can that be done also after shkiah? I wonder because I've only ever seen a Hachnassas Sefer Torah by day.
The Rambam (Hilchos Sefer Torah 7:1) writes: “It is a positive commandment for every man in Israel to write a Sefer Torah for himself, as it is written, ‘And now, write for yourselves this song.’”
Nowhere is it mentioned that this mitzvah is limited to the daytime (as opposed to e.g Tzizit where the Torah obligation is only by day). In Israel it is very common to do a Hachnassas Sefer Torah at night.
Additionally Many meforshim say the purpose of writing a Sefer Torah is for Torah study. Since we are obligated to study Torah by day and by night therefore it would be ok to complete the Sefer Torah at night.
Sefer HaHinnuch Miswa 613
The Miswa of writing a Torah is applicable everywhere and at all times.