The line
@out = push (@out, @newin); is pushing the contents of @newin onto the array @out, then push returns a value of the number of elements now in the array @out. That value is
1 and it gets assigned to @out, replacing the earlier contents.
If you change the line question to just push (@out, @newin); you will get the results you expect.