In order to rent a room, you need to agree with the other party how much they will pay; how long they will be there for; and any other obligations you want them to have. If the renting period is intended to be under one year, it does not need to be in writing to be legally valid, but having a document will make the agreement easier to enforce. If the intended renting period is over a year then writing is required.