A downgrade of this magnitude will be very difficult to achieve. A couple things to try:
bench migrate-env python2.7 (if 2.7 is on the host)
then
bench switch-to-branch v8.x.x frappe erpnext (sudo shouldn’t be needed)
then
bench update --patch
Downgrading is not possible. Not unless you’re already an expert in ERPNext, -and- spend a lot of time on it.
The problem is not the Python and JS code. That part is easy. You can accomplish that with simple git commands (which is what 'bench switch-to-branch' is doing automatically for you).
The problem is the MySQL database. When you upgrade versions, the database schema changes. To handle this, ERPNext runs “patch” code. The patch code helps convert your business data (Customers, Sales Orders, Items, Bills of Material), from Old Schema → New Schema.
However, ERPNext does not have “un-patch” code, that applies the data changes in the opposite direction. There is no process to transform v13 data tables into v8 data tables.
The only solution is performing this conversion manually, on your own. You would have to be extremely familiar with the ERPNext database schemas, default values per version, and a bunch of other stuff.
Can it be done? Yes. I’ve done a manual conversion like this 1 time. The effort was huge.