It seems that for odd and even pages you do not set the left and right positions of the page numbers, but you need to set them outside and inside .
So try changing this tiny line:
.Add (0)
to one of the possible "odd-even" positions:
.Add wdAlignPageNumberOutside .Add wdAlignPageNumberInside
In addition, the last line that tries to insert a tab is not needed.
source share