By default, if an end-user CCs an Agent on a Ticket they will not be added to the Ticket, so when the Agent replies a new ticket will be created because the helpdesk will treat the Agent’s email as a new Ticket.
You can change the default behavior, which means when an Agents is CC’d on a Ticket they will be processed as a Ticket Follower. Go to Channels > Email > Settings, under Inbound Email Settings, and enable the Allow users to CC agent email addresses to add them as followers option:
There are implications of enabling this setting because when an Agent is a Follower on a Ticket, they will be able to view the Ticket, regardless of any Ticket or Department Permissions that would prevent them from otherwise seeing it. This would allow the Agent to carry out actions on a Ticket that they would otherwise not be allowed to.
If you want to restrict Agents from being able to do so, it would be better to not enable this option.