Modifying contribution modules safely and conventionally
You should not modify the contrib module directly and save it. You should create a patch file and use that patch file in the project. This way every time if there is any update in that module, you run drush command and your changed will be safely applied. Please refer this page to create a patch file if you don't know How to create Drupal patch with git.