I want to use an array to control output values. What can I do?

You are writing the same value,(127), 255 times to the same pin.

Edit, correction: you're writing the same value 255 times, but I have no idea what that value is.
Neither do you.