Help with for loops and structuring output

Currently the output looks like this"

‘abc’
‘abc-repo/5489’
‘abc-repo/5488’
‘abc-repo/5482’
‘foo’
‘bar’

Notice that the urls for the last 2 repos are empty, so ideally it should look like:

‘abc’
‘abc-repo/5489’
‘abc-repo/5488’
‘abc-repo/5482’
‘foo’
‘foo-repo/69’
‘foo-repo/68’
‘foo-repo/67’
‘bar’
‘bar-repo/57’
‘bar-repo/56’
‘bar-repo/55’

I would really appreciate some help regarding this workflow. Thanks!