I am trying to derive this formula:

but I do not understand the parts underlined by red (I do not get from where they were derived)
Here's my attempt (sorry it's handwritten, it would take me so long to write it in mathjax):
Edit: $Var(\bar{y})$ = $(1-f)\frac{S^2}{n}$ and it's the final form we need to reach (where $n$ is sample size and $(1-f)$ is the finite population factor.
Thanks in advance
