Can i take these 3 bunches of code below

so is that why the code starts with 3 seprate chunks and make it send 3 mqtt messages? i don't understand why they decided to make the code this way.