Hello,
Generally we should deploy our customization in Alfresco by using AMP which we can generate by Maven and Eclipse.
It's not good practice to do changes in deployed Alfresco as it will be difficult for upgrade. However if you still wish to do changes in deployed Alfresco then you have to follow extension mechanism. So all your changes will go to $TOMCAT_HOME/shared/classes/alfresco/extension folder and it will be separate from your deployed Alfresco which make easy for you future upgrade.
Thanks,
Krishna