How to preserve the number of errors at the level of the package in SQL or .txt file?
Package variables to the rescue!

If you need to capture the number of times the failure is triggered, you can create a package variable then connect an Expression Task to the failure pathway that increments the variable by 1.

If you need to track the total rows affected, you need to create two variables, one for row count and row count total.  You can add a Row Count task within your Flat File Destination, then have an Expression Task afterwards that adds that to the row count total variable.

Visit https://www.simple-talk.com/sql/ssis/ssis-basics-introducing-variables/ for an introduction to SSIS variables.