There does not exist such a function. We recall that a function $f:[a,b] \rightarrow \mathbb{R}$ is absolutely continuous if and only if it is continuous, of bounded variation and has the property that $f(A)$ has Lebesgue measure $0$ whenever $A\subset [0,1]$ has Lebesgue measure $0$ (this last property is known as the Luzin-N-property). Now, if $f:[0,1] \rightarrow \mathbb{R}$ is as in your hypothesis and $A\subset [0,1]$ has Lebesgue measure $0$ then
$$f(A)=f(A\cap \{0\})\cup \bigcup\limits_{n=1}^\infty f(A\cap [1/n, 1]).$$
The assumption that $f$ is a.c. when restricted to any subinterval $(a, 1]$, $a>0$, gives that all the sets in the union on the RHS have measure $0$, thus the LHS has measure $0$. Thus $f$ satisfies the Luzin-N-property and is a.c.
Edit: One can also prove it directly. Let $\epsilon>0$. We claim that there is a $\delta>0$ such that $V_0^\delta (f)\leq\epsilon$. Indeed, if this isn't the case we have $V_0^\delta (f)>\epsilon$ for all $\delta>0$. Using the continuity of $f$, pick $\delta'>0$ such that $|f(x)-f(0)|<\epsilon/2$ for $x\in [0, \delta')$. Then there is a partition $$0=x_{1, 0}<x_{1,1}<\ldots <x_{1,n_1}=\delta'$$
with $\sum\limits_{i=0}^{n_1-1}|f(x_{1,i+1})-f(x_{1,i})|>\epsilon$. Then
$$\sum\limits_{i=1}^{n_1-1}|f(x_{1,i+1})-f(x_{1,i})|>\epsilon/2.$$
Now use that $V_0^{x_{1,1}} (f)>\epsilon$ to obtain a partition
$$0=x_{2, 0}<x_{2,1}<\ldots <x_{2,n_2}=x_{1,1}$$
with $\sum\limits_{i=0}^{n_2-1}|f(x_{2,i+1})-f(x_{2,i})|>\epsilon$. Then again $$\sum\limits_{i=1}^{n_2-1}|f(x_{2,i+1})-f(x_{2,i})|>\epsilon/2.$$
Continuing like this we obtain infinitely many non-overlapping partitions with total variation at least $\epsilon/2$. This contradicts that $f$ has bounded variation on $[0,1]$. The conclusion is that there is a $\delta>0$ such that $V_0^\delta (f)\leq\epsilon$. Since $f$ is a.c. on $[\delta, 1]$ there is a $\delta''>0$ witnessing the $\epsilon$ condition in absolutely continuity on $[\delta, 1]$ . Then $\min(\delta, \delta'')$ will witness the $2\epsilon$ condition in absolutely continuity on $[0,1]$.
Best Answer
$$g(x) = -\frac{1}{x}\cos\left(\frac{1}{x}\right) + \sin\left(\frac{1}{x}\right)$$ is not integrable on $[0,1]$. Hence the equality
$$\int_0^1 (-\cos(1/x)/x + \sin(1/x)) dx=\sin(1)$$ is wrong and $g$ is not absolutely continuous.