This is very simple to achieve. Try below code:
DECLARE inputRef REFERENCE TO InputRoot.XMLNSC.NS5:CAIAssembly;
DECLARE Ref_CAIComponent REFERENCE TO inputRef.NS5:CAIComponent[1];
--Now run the below loop
WHILE LASTMOVE(Ref_CAIComponent) DO
CREATE FIELD OutputRoot.XMLNSC.components[index];
DECLARE outRef REFERENCE TO OutputRoot.XMLNSC.components[index];
SET index=index+1;
SET outRef.productCd=Ref_CAIComponent.NS5:CAICode;
SET outRef.quantity=Ref_CAIComponent.NS5:Quantity;
MOVE Ref_CAIComponent NEXTSIBLING REPEAT NAME;
END WHILE;
P.S. It's good practice to struggle and find solutions at your own, rather than searching for spoon feeding.