I’m no mathematician, but I can only assume the logic is wrong. I used a simple Python program to compare the answers from a simple GCD of two integers, and simulating what the code does.
import math
mod = 1000000007
print(math.gcd(9999883 * 9999937 * 9999907, 9999901 * 9999973 * 9999907) % mod)
num1 = 1
num1 = ((num1 % mod) * (9999883 % mod)) % mod;
num1 = ((num1 % mod) * (9999937 % mod)) % mod;
num1 = ((num1 % mod) * (9999907 % mod)) % mod;
num2 = 1
num2 = ((num2 % mod) * (9999901 % mod)) % mod;
num2 = ((num2 % mod) * (9999973 % mod)) % mod;
num2 = ((num2 % mod) * (9999907 % mod)) % mod;
print(math.gcd(num1, num2))