Series Trick

So I was wondering if this was "legal in math to do" I saw it on a YouTube video of turning your series into a function that is being evaluated and turning a (zero-th integral) into a regular integral but take the derivative of the new function.

So I was wondering if this was "legal in math to do" I saw it on a YouTube video of turning your series into a function that is being evaluated and turning a (zero-th integral) into a regular integral but take the derivative of the new function.