If the reply is from the requester of the ticket or anyone part of the ticket conversation thread(in cc to the ticket conversation), Freshdesk will check for the Message ID and append the reply to the original ticket accordingly.

If the replies are coming in from a person new to the thread or an entirely new email, the system will look to append the reply based on the Ticket ID in the subject line, which would have to be of the format [#{{ticket.id}}](for ex., [#12345], where the ticket id is 12345). This concept is used for replies to emails sent by Automations or Email Notifications. 

Check out this article if your replies are not appended to original ticket.