It feels fairly ridiculous to me that you can't do simple increments of a counter that works on all three platforms (iOS/macOS/watchOS).
There is a hack that works with only default scripting functions, but only within a repeat loop.
- Use the "Number" verb to create a text item.
- Use the "Add Variable" verb to append the Number to a text variable.
- Use the "Count" verb to count the items in that text variable.

We'll see if things change in iOS 17 to make Shortcuts.app better.