This is because you’re comparing a string to an integer. The order matters.
"56" -lt 7
Is actually the same as:
"56" -lt "7"
Alternatively:
56 -lt "7"
would give you the correct result. PowerShell tries to coerce the right side argument to the type of the left side.
You might try an explicit cast:
[int]$Input -lt $GeneratedNum