You do not have to add the last ' = IteratorKlant/KlantAdresPostcode ' it will work without
and you need to if else then condition.
if lenght() ... > 7
else if length < 7
then substring() + '' + substring()...
if [condition] then [value] else [value]
My main suggestion would be to never save values based upon what some sort of export or external application might consume; always store it how you would like it and transform the value based on the need of the other application or export. This will also increase consistency when you have multiple places where you might store the postalcodes (so you won't have a table with postalcodes with a space and another table with postalcodes without the space). Another suggestion is to limit the amount of characters... if your max string length is 6, it should be set to 6. That way it will simply give an error when it gets larger (unexpected) than 6. Then it's easy to fix it and make sure the postalcode is saved properly at that point.
If you'd always save it without the space (easy to remove on save/change), you'd only need to add the space when exporting to excel:
(assuming you already checked that the postalcode is valid and contains 6 characters).
I don't really get how exporting would add extra spaces; only thing I can think of is that with every save, a space is added (so if I save 1234AB, I get 1234 AB... and if I change it again, another space is added: 1234 AB, etc. So adding a space without checking beforehand if the space is not already present, could create unexpected results. Another strong point to set the maximum string length to your required result (6/7).
But the changes Jelle suggest would work: