Hi,
You need to create:
-script with brightness control which calls itself during the time the button is being pressed.
-input_boolean to control wether to increase or decrease brightness
You can find more information and details in this forum post.