Brindisi → Ostuni
Easy transfer. STP Brindisi Bus or FlixBus
Ostuni → Matera
More complicated. Probably the best is to take a train to Bari then go to Matera via train or bus (bus better and faster)
Matera → Alberobello
Very easy by car (it was just over 1h drive for me last year), but time consuming by public transit as you need a bus or train (bus better) to Bari, then a bus to Alberobello (very frequent and fast)
Alberobello → Bari
Easy bus transfer, very frequent. See above
Assuming you want to fly to Brindisi (I'd fly to Bari for your plan), it is better to change your itinerary as follows:
Brindisi - Ostuni - Alberobello - Bari - Matera
If you fly to Bari (preferable in my opinion):
Bari - Matera - Alberobello (via Bari) - Ostuni - Bari.
If you can rent a car, that would be great. This year and last year I visited both Ostuni and Matera from Alberobello. Alberobello to Matera is just 1+ hour drive. Alberobello to Ostuni is maybe 50 min drive. And next to Alberobello is also Locorotondo (very quaint) less than 10 min drive away.