I agree that this looks like homework. Regardless, you need to give some context for the question, and you need to state the problem completely. You show an example output file, but you don't state the rule to be followed---ie the criteria for where to insert something and what to insert.
What utilities are you familiar with--eg SED, AWK, TR?
If homework, tell us more about the class, the books you are using, etc.