How to add a continuous number to HTML tag attribute value inside The Loop [closed]

You could make use of the WP_Query property $current_post

$current_post
(available during The Loop) index of the post currently being displayed.

It can be used for your purpose.