How to add some code and do not afraid update of erpnext?

I need add this code: How can I use multiple fields for a title? - #11 by hashir

but I afrid, that new update will delete it. How to do new things and do not afraid updates?

If the code is in the erpnext or frappe apps, it will get erased on update. If it’s in your own app, it won’t.

For this case, you might consider using the override_doctype_class method to provide a custom validate method:

https://frappeframework.com/docs/user/en/python-api/hooks#override-doctype-class