How to generate a large number of accounts via hw wallet and save addresses to file?
Your best bet would be to export the xpub key for each account from your ledger. Once you have that, generating new addresses can be automated via any number of bitcoin libraries, such as bitcoinjs-lib. Similar options exist for ethereum.

I'm not entirely sure if they have a straighforward way to export the xpub, but I recall seeing it in the ledger live logs at some point. You can either use that, or connect to a wallet such as Electrum, which would export it for you.