It's extremely straightforward.
- Initialise the count to zero.
- While haven't reached the end of the file,
- Read a line.
- If the line consists of a bunch of stars,
- Add 1 to the count.
- Format the count.
- Append formatted count to the line.
- Print the line.
What have you tried?