I'm trying to create an array and store values in it within for loop but failed so far. How can I do it with Twig?

I've read these but being new in Twig makes it hard to convert into my case.

* [Twig for loop and array with key](https://stackoverflow.com/questions/10299202/twig-for-loop-and-array-with-key)
* [How to set array value in twig template](https://stackoverflow.com/questions/21113197/how-to-set-array-value-in-twig-template)
* [twig - building array in for loop](https://stackoverflow.com/questions/20841206/twig-building-array-in-for-loop)
* And many more

**PLAIN PHP LOGIC IS THIS:**

```
foreach ($array as &$value)
{
   $new_array[] = $value;
}

foreach ($new_array as &$v)
{
   echo $v;
}

```

**WHAT I'VE TRIED WITH TWIG:**

```
{% for value in array %}
    {% set new_array = new_array|merge([value])  %}
{% endfor %}

{% for v in new_array %}
   {{ v }}
{% endfor %}

```