AppendTo
AppendTo[x, elem] appends elem to the value of x, and resets x to the result.
Examples
Append an element to a list:
list = {1, 2, 3};
AppendTo[list, 4];
list
(* {1, 2, 3, 4} *)Build a list incrementally:
result = {};
Do[AppendTo[result, i^2], {i, 5}];
result
(* {1, 4, 9, 16, 25} *)Please visit the official Wolfram Language Reference for more details.