raa442:
I have changed the speed in this way because the motors must finish the G-code command at the same time.
The AccelStepper library is specifically NOT suited to that requirement. There is a MultiStepper variant of the library for that but it cannot use acceleration - I don't know if that would be a problem.
To make it easier for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum
Your code is too long for me to study quickly without copying to a text editor.