Step [1] will insert a newline character at the beginning of every double-quoted string, make the line above be
a b \n"c d e" f g \n"h i"
This will eliminate the chance of mistaking " f g " for a double-quoted string.
Step [2] thru [4] constitute a loop. This loop will process double-quoted strings from left to right, and replace space characters of a string from right to left. The pattern space will be changed in the following sequence:
a b \n"c d-e" f g \n"h i"
a b \n"c-d-e" f g \n"h i"
a b \n"c-d-e" f g \n"h-i"
Step [5] will remove all newline characters added by step [1].