In a pid, let a and b generate the principal ideal c*R. Clearly c divides a and b. If g = gcd(a,b), g divides a and b, and g*R contains the ideals a*R and b*R, and hence c*R. thus g divides c. Yet c divides g, hence c = g. Since g is generated by a and b, it is some linear combination of a and b, using coefficients from R.
Generalize this to a finite list of elements. Their common gcd is a linear combination of those elements. For instance:
g = ax + by. h = gcd(g,c). h = wg + zc. h = wxa + wyb + zc.
Proceed by induction on the number of elements in the set.
Bezout's identity fails for arbitrary ufds. In Z[x], the integer polynomials over x, 2 and x are coprime, yet no linear combination of 2 and x yields 1.