Old Testament scripture is spoken of as if it were a person who could encourage others. Alternate translation: "what God has instructed you in the scriptures to encourage you" (See: [[rc://en/ta/man/translate/figs-personification]])
The word translated "sons" and "son" is specifically the word for a male child. In that culture the family line continued through the sons, not normally through the daughters. However, as stated by the UDB and some English versions, the author is directing his words to both males and females. (See: [[rc://en/ta/man/translate/figs-gendernotations]])
This can be stated in positive form. Alternate translation: "take it very seriously when the Lord disciplines you, and do not grow weary" (See: [[rc://en/ta/man/translate/figs-litotes]])