There is no telling why people downvote things; they are not required to explain, and don't always volunteer. There are good and bad reasons to downvote questions.
I tried to edit the question to make it read as well as possible for the site. The primary point to make here is that Stack Overflow is not a discussion forum; we do not want "noise" in the post - this means: saying hello or thanks; talking about how frustrated you are with the problem; talking about your level of experience with the tools involved; talking about the urgency of the task; or anything else "meta" like this. In other words, we only want text that directly helps to understand either the problem, or the question being asked about it.
In some cases, a brief motivation is useful ("I want the code to do X because I will use it for Y"), because it can help answerers understand exactly what you mean, or confirm if you have an XY problem. Normally, it is better to wait to be asked for this. People will ask whenever X is either really weird ("why would you want to do that?") or they've seen that XY problem before ("I've seen a lot of people assume that they need to do X in order to accomplish Y; it is a misguided approach").
The second issue here is the focus of the question. I edited a few sentences that were expressing a general confusion; in my replacement, I tried to preserve the part where you expressed confusion about what part of the code does. However, this sort of thing makes the question less suitable for Stack Overflow. For one, it is a separate question from "how do I make the script wait until the other process completes?". For another, we can't help you with it, because we don't know why you are confused.
Finally, there is a minor issue of applicability. If the question is specifically about how to make the AppleScript wait for another shell script to complete, then a really good question has code that:
focuses on that question, and the problem in context (see https://stackoverflow.com/help/minimal-reproducible-example)
is generic enough that other people who find the question with a search engine, will be able to recognize that this code matches what they are trying to do, and is not just some other random person's personal debugging request.
As for the answer, it could use some explanation. See https://stackoverflow.com/help/how-to-answer for some guidance, and also try to put yourself in the shoes of someone else who had the same problem. Will they understand why the code change fixes the problem? How does it fix the problem? Can you describe what you are changing and why, rather than just showing the exact edits? (Edits like this are hard to understand. Even just showing the corrected version of the code is clearer.)