Thats very tricky with the limited elements of home assistant and causes into a complicated blueprint setup imho since the default schedulers are only binary.
To achieve this that scheduler component would be better:
I would be easier to set the input_number comfort temperature in a 2nd automation or with help of this scheduler component.