Let $R=k[X_1,...,X_n]$ be a polynomial ring, where $k$ is a field.
Suppose we have a Gröbner basis $G = (g_1, g_2, ... , g_n), g_i \in R$ for the ideal $I = \langle f_1, f_2, ..., f_m \rangle, f_i \in R$ and that we have using the division algorithm for polynomials in several variables that $f^G = 0$ for $f \in R$ (remainder from division by $G$ is $0$).
Since $f \in I$ if and only if $f^G = 0$ we know that $f \in I$.
Now we want to write $f= a_1f_1 + \cdots + a_nf_n$ for $a_i \in R$ as a $k$-linear combination of the polynomials generating $I$. We know we can do this, since we assumed that $f^G = 0$.
We can easily write $f$ as a $k$-linear combination of the polynomials in $G$, since the remainder is unique and $0$ for every permutation of $G$. So let $f = b_1 g_1 + \cdots + b_n g_n$.
Can I use this to easily find a way to write $f= a_1f_1 + \cdots + a_nf_n$ ?
It can be tiredsome to to write $f$ as a $k$-linear combination of polynomials $f_i$, since there are several path to take during the algorithm.
If you found $G$ using Buchberger's algorithm then you constructed them as linear combinations of the $f_i$. You can then substitute these expressions into $f = \sum b_ig_i$ to get $f$ as a linear combination of the $f_i$.