You now have a rectangle and right-angled triangle.
The sides of this triangle are 22cm, 20cm and (30-k)cm.
To use Pythagoras theorem, the triangle must be right-angled, as this one is.
The sum of the squares of the two shorter sides is the square of the longest side, the hypotenuse.
Then, your formula is
Multiply this out and write the quadratic equation for k.
K is positive, so find the positive answer for k, when you solve the quadratic, by factorising it after bringing all terms to one side, making it =0,
or using the quadratic formula.