When a return type (when creating the function) and value (return value action) is set, the function can be used as an expression, where it will return the return value when used.
= 5!
= 5 * 4 * 3 * 2 * 1
= (5-0) * (5-1) * (5-2) * (5-3) * (5-4)
Where n=5 and loopindex is the number of times the loop has repeated, starting from 0. Each iteration of the loop is multiplied by the result of the previous one, stored in output. We're starting with output=1, so the first iteration of the loop is 1*(5-0) (1*n-loopindex), which results in 5. The next loop will be 5*(5-1), and so on.
Once the loop is complete, it then takes output and makes it the return. The return is then returned to the expression that we typed earlier and inserts it into the parameter parenthesis, so that it basically says "Set result to Function.Factorial(120)". return is then set to whatever is inside the parenthesis.
To clarify, it doesn't really replace and insert into the parenthesis. The number in the parenthesis is the parameter used to run the function. The entire "Function.Factorial(5)" function, as an expression, equals (or is replaced by, if you want to use that wording) whatever is set as the return value inside the function.
So in the end that action is in effect "Set result to 120". Note this is different than "Set result to Function.Factorial(120)", which would be... a very big number.