Even when getting a temporary house for free, you may want to sign a contract that states that the house that you are getting is for free and setting the length of your stay, as well as your responsibility to leave the house in good conditions.
To that end, Portugal has a particular type of contract, called a “Contrato de Comodato”.
You can find a template of this type of contract here in Ukrainian:
https://docs.google.com/document/d/1ECzvq6vcle4yabs2_R8C7Nd0vUh0hZBd/edit
and in Portuguese:
https://docs.google.com/document/d/1ECzvq6vcle4yabs2_R8C7Nd0vUh0hZBd/edit?usp=sharing&ouid=108943811941173543127&rtpof=true&sd=true
If you have any doubts, feel free to reach out to the admins of our Telegram self-help group, at https://t.me/toportugal