The rhetorical device that is used here is parallelism.
It happens when two or more parts of the same sentence have a similar (or even nearly identical) structure or a choice of words. There's only a slight difference, and this difference is the very point. Parallelism is used to emphasize the importance of this point. Sometimes, there are multiple repetitions of the same structure or words, with only one word varied throughout the text.
This happens in the Bible, for example.
"Ascribe to the Lord, O mighty ones,
ascribe to the Lord glory and strength.
Ascribe to the Lord the glory due his name;
worship the Lord in the splendor of his holiness."