Hello Muhammad Farash. Thank you for using Wazuh!
Indeed, if you want to upgrade Wazuh from version 4.2.5, you should follow step by step the links you have sent without worrying about losing your data as they are processes from the official Wazuh documentation, and as such they are totally reliable, and their correct follow-up is guaranteed. In addition, you should also bear in mind that it is always advisable to make backups of your data before carrying out such processes, so you should save the data you want to keep before upgrading. You can also visit this page for wazuh backups:
https://documentation.wazuh.com/current/migration-guide/files-backup/index.html.
Best regards!