Well first of all, that's not a square. On a square, all 4 sides are the same, and the length is the same distance as the width. If the width of a square is 6, and all four sides are the same, then the perimeter is (4 x 6) = 24.
So the shape in your question may be a rectangle, but it's definitely not a square one.
The perimeter is the distance an ant has to walk if you put him down on one corner and he walks all the way around the shape until he gets back to where he started from. That's the perimeter.
If you set the ant down on the corner of a rectangle, then he walks the length, then the width, the the length again, then the width again, and he's back where he started.
That was 2 lengths and 2 widths ... the perimeter of every rectangle.
Take 2 widths away from the perimeter, and you have 2 lengths left. OK ?
You said that the width of your rectangle is 6. Two widths is 12. Take the 2 widths away from the perimeter, and you're left with (20 - 12) = 8. But that's 2 lengths ! So the length is half of 8 = 4 .