Ruling on staying overnight in the mosque and teaching children and feeding them there
Question

                I live in a European country and I am a seeker of Islamic knowledge. I teach Muslim children in the mosque and I am living in the mosque at present. The mosque is registered with the government on the basis that it is an Islamic organisation that holds different activities, including prayers. At the main door of the mosque there is a washroom and by this door there is a passageway from which there are two entrances, one of which leads to the women's room where they pray Jumu’ah and the other leads to the mosque. On the other  side of the mosque there is an area which is a kitchen that opens onto the mosque. 

What are the guidelines on my staying in the mosque? I use the computer belonging to the mosque to learn Qur'aan via Paltalk; I also use the library of the mosque in order to seek knowledge and prepare khutbahs. 

Do I have to pray tahiyyat al-masjid (two naafil rak’ahs to “greet the mosque”) every time I go to work or every time I go to the washroom or every time I leave the mosque to do a quick errand? 

We use the kitchen of the mosque to make food when doing a communal iftaar during Ramadan, and to make tea and food for guests or for myself. Is that permissible? Is it permissible for me to eat from this kitchen? 

Another question: in the mosque there is a projector which we use to teach children about their religion, because this is very helpful in conveying information to them. In the library there is a blackboard which we also use for teaching. We also offer the children biscuits (cookies) and juice to encourage them to come to the mosque, and we give that to them in the mosque. Is that permissible?.
Praise be to Allah.
      Firstly: 

    There is nothing wrong with your staying in one of the rooms 
    attached to the mosque or with teaching the children and using the computer, 
    projector, blackboard and other means that help in teaching. 

    There is also nothing wrong with offering biscuits and juice 
    to the children in the mosque, so long as you teach them to avoid causing 
    any nuisance and to be keen to keep it clean. 

    Secondly: 

    If a person goes out of the mosque and intends to come back 
    soon, then he does not need to pray tahiyyat al-masjid. 

    Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was 
    asked: I entered the mosque and prayed two rak’ahs to “greet the mosque”, 
    then I went out intending to return. When I return, do I have to pray two 
    rak’ahs again? 

    He replied: If a person goes out of the mosque with the 
    intention of coming back, if he returns soon then he does not have to pray 
    tahiyyat al-masjid, such as if he went out to do wudoo' and came back, or he 
    went out to bring a book from home and came back, or he went out to speak to 
    someone and came back. In this case he does not have to pray tahiyyat al-masjid, 
    because the time was short. But if the time was long, then he should pray 
    two rak’ahs. All of us, when we have prayed Zuhr, leave the mosque with the 
    intention of coming back to pray ‘Asr, but can we say when we come back to 
    pray ‘Asr that we should not pray tahiyyat al-masjid? No, we should pray it. 
    What matters is that if it is for some errand and we will come back quickly, 
    then we do not have to pray tahiyyat al-masjid and the first time we did it 
    is sufficient. The evidence for that is that the Messenger of Allah 
    (blessings and peace of Allah be upon him) gave permission to the one who is 
    observing i’tikaaf to go out to his house if he needs to and then come back. 
    This indicates that going out for a brief time is not regarded as leaving 
    the mosque. So for the one who goes out of the mosque with the intention of 
    returning soon, it is as if he did not go out of the mosque.

    End quote from Liqa’ al-Baab al-Maftooh, 30/125 

    Thirdly: 

    If the rooms attached to the mosque were built to be part of 
    the mosque, i.e., the builder of the mosque intended that they should be 
    part of the mosque in which prayers are offered, then they come under the 
    same rulings as the mosque, so the two rak’ahs for greeting the mosque 
    should be offered when entering them, and women who are menstruating or 
    bleeding following childbirth should not be allowed to stay in them. 

    But if these room are intended to be extra rooms for teaching 
    or holding meetings, or a place where the imam or muezzin lives, and are not 
    intended to be a place for prayers, then in that case they do not come under 
    the same rulings as the mosque. 

    If the intention of the one who built the mosque is not 
    known, then the basic principle is that whatever is within the walls of the 
    mosque and has a door opening into the mosque comes under the same rulings 
    as the mosque. 

    This is what may be understood from the words of the scholars 
    concerning the rooms and other facilities that are found in the mosques, 
    taking into account the differences in the situation nowadays as compared 
    with what was prevalent at the time of the earlier fuqaha’. 

    We have quoted the fatwas of the scholars concerning that in 
    the answer to question number 
    118685. 

    Fourthly: 

    There is nothing wrong with using the kitchen to prepare 
    communal iftaars in Ramadan or to make tea or food for guests. 

    But with regard to making food there on an ongoing basis, 
    that is not appropriate because it would result in filling the mosque with 
    the smell of food, which is contrary to proper care and respect of the 
    mosque, unless there is a wall to separate the kitchen from the mosque. This 
    applies if the kitchen is not regarded as part of the mosque, as stated 
    above.