@W3P
You can create a custom Short Answer
Field on your Ticket Details Form with a Label of Reference Number
and a Variable name of reference_number
(variable is required in this case). Now you can go to Admin Panel > Emails > Templates, click the desired template set, click on Response/Reply Template, add the variable %{ticket.reference_number}
wherever you want, and save changes. Afterwards, when a User submits a Ticket with a reference number the Agent can fill in the Reference Number field on the Ticket. After the Agent fills in the field in the Ticket they can reply to the User and the value from the Reference Number field will be populated in the email.
Cheers.