Hmmm ... You were almost ! there. Just in the last statement you are not pumping the string w = xyz
at y
.
Now we start by assuming that L is regular where L = { w | w in {0,1}* and w has equal number of 0s and 1s }
and then we will go on to prove that for any i >= 0
the pumped string i.e w = xyiz does not contain the equal number of 0s and 1s ( a contradiction per se) therefore, the language is not regular :
L is given by :
L = {0n1n | n >= 0}
Iff y = 0t => w = 0n-t0t1n
Now after pumping y for i >= 0 we get
xyiz = 0n-t0it1n
-> xyiz = 0n+(i-1)t1n
Now since n+(i-1)t is not equal to n this contradicts our assumption that L = { w | w in {0,1}* and w has equal number of 0s and 1s }
therefore xyiz does not belong to L
NOTE- You also need to consider other cases like y = 0t11 , y = 1t etc and later on prove that these do imply a contradiction.