Atticus does this automatically for you. All you need to do is ensure:
every chapter in Atticus has a relevant title in the “Chapter Title” area, and
that no two chapters have the exact same title
Atticus will take care of the rest! When you export your ePub file, the table of contents will be automatically generated and fully linked to the corresponding chapters.