Let $X$ be a compact Hausdorff space and let $f: X \to \mathbb{R}$ be a continuous function. I want to prove that we have a unique decomposition
$$f= f_1 - f_2$$
where $f_1 f_2 = 0 = f_2 f_1$.
where $f_1, f_2: X \to \mathbb{R}$ are continuous positive functions. I managed to show the existence, but I'm not sure how I can prove the uniqueness.
Uniqueness easily follows from the condition $f_1f_2=0$. This means that for every $x \in X$ you have $f_1(x)=0$ or $f_2(x)=0$ and $f(x)=f_1(x)-f_2(x)$, this implies if $f(x)>0$ then $f(x)=f_1(x)$ while $f_2(x)=0$ and vice versa $f(x)<0$ implies $f(x)=-f_2(x)$. If $f(x)=0$ then $f_1(x)=f_2(x)$ and their product must be zero: that is $f_1(x)=f_2(x)=0$.
Existence is an easy application of the pasting lemma, since you said you already proved it I won't go into detail.
Edit: since you asked in the comments I am going to explain how the pasting lemma can be used to provide the maps. Since $f$ is continuous $N=f^{-1}((-\infty, 0])$ and $P=f^{-1}([0, +\infty))$ are both closed subsets of $X$. The pasting lemma states that if you have two continuous function $g,h$ defined on closed subsets of a topological space and they coincide on the intersection then gluing them together you get a continuous function on the whole space.
In our case you can take $g\colon P \rightarrow \mathbb{R}$ to be $g=f|_P$ and $h\colon N \rightarrow \mathbb{R}$ to be the zero function. Applying the lemma you obtain a function which is your $f_1$.