Hi Jun,
This is a good question.
Essentially, 'by' and 'at' refer to different types of prepositions. But, to make things a little less complicated, think of saying 'at night' as meaning doing something at a particular time in the night. I will go to sleep 'at night', for example. So, maybe 9 pm. Alternately, 'by night' suggests that something needs to be done during the night - so, not necessarily at a specific time, but definitely in the night time. So, for example, 'I will do my homework by night' , meaning I will not do it during the day, but rather by night - in the night - so to speak.
I hope this helped.
Nice question. Take care.