Update variable values between with loop iteration

Expectation:
The newValue should be added to the baseValue with each iteration, so here i am expecting final value as 4.

1st Iteration:
baseValue 1 + newValue 1 = 2
2nd Iteration:
(output of 1st iteration) 2 + newValue 2 = 4
Final output:
(output of 2nd iteration) 4

Below is the example code,
do_sum:
action: mypack.myaction
input:
baseValue: 1
newValue: ‘{{ item() }}’
with: <% range(2) %>