Use the function $\hat f(x)=\min_{t\ge 1/n}f(t)$ for $\frac 1{n+1}<x\le\frac 1n$. Then, let $g$ be the line segments between the points $\left(\frac 1{n+1},\hat f\left(\frac 1{n+1}\right\right)$ and $\left(\frac 1n,\hat f\left(\frac 1n\right)\right)$. Only problem is if $\hat f$ does not change on the interval $(\frac 1{n+2},\frac 1n]$ but that is easily repaired.