Worth flagging first: this is a request for a walkthrough rather than a question, which is why it has not been answered as one.
For what it is worth, bad ends in Clannad usually come from choices made outside a character's own arc. Save often, follow Kotomi's scenes whenever they appear, and avoid committing to other routes until hers is complete.