Yah, I was under the impression that input_text.door_keypad_x_name was a user_id or name.
This line just adds a bunch of strings together to end up with an input_text entity id.
{% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
This line checks the number. If the number equals zero, it sets the user equal to “Master”. If the number is any other number, it gets the state from the entity_id variable and sets user equal to that.
{% set user = 'Master' if number == '0' else states(entity_id) %}