Need to handle size of array dynamically in SOAP response structure and update the values of array item

Considering a XML tag <get:numberOfDays xmlns:get="http://abc.com">30</get:numberOfDays>, we will need to provide the date slots available in response structure. 

For example, response structure - 

<availableDatesList xmlns="http://abc.com">
<availableDate>
<ent:installStartDateTime>30122023 12:00</ent:installStartDateTime>
<ent:installEndDateTime>30122023 16:00</ent:installEndDateTime>
</availableDate>
<availableDate>
<ent:installStartDateTime>30122023 08:00</ent:installStartDateTime>
<ent:installEndDateTime>30122023 12:00</ent:installEndDateTime>
</availableDate>
<availableDate>
<ent:installStartDateTime>29122023 12:00</ent:installStartDateTime>
<ent:installEndDateTime>29122023 16:00</ent:installEndDateTime>
</availableDate>
</availableDatesList>