This topic has been discussed many times, and it is not a simple as you make it out to be. What happens if two people enter at once? What happens if someone breaks the first beam, and then backs out, never tripping the second beam? What happens if someone breaks both beams, but then backs up and reenters the room.
If you can ensure that none of these conditions can happen, then you can successfully count the number of people in the room.
I need to know wich kind of code i can use in order to relate the counting with the output.
Only you know what you want the Arduino to do based on the number of people in the room.