Your proof is very confusing.

Quote:

Assume that f is not injective, that is, there exists a z that belongs to Z for each y that belongs to set Y such that f(y) != z.

This is the definition of surjective, not injective, function.

Quote:

There exist y1,y2 belong to Y, y1!=y2, such that f(y1)!=z and f(y2)!=.

Only when Y has more than one element.

Quote:

By definition of injection, y1=g(x1) and y2=g(x2) for some x1, x2 that belong to X.

Again, you confuse injection and surjection.

Quote:

For f o g to be injective we have f(g(x1))=f(g(x2))

I don't see why this is necessary.

Quote:

whcih means f(x1)=z and f(x2)=z.

The function f cannot be applied to x1 because x1 is in X, but f : Y -> Z.

Quote:

Then, it is not necessary for f to be injective when f o g is injective.

This fact does not need a general proof. Plato proved it by providing one counterexample.