How to automate installing apps from f-droid?

I have more than 100 apps installed on my phone and 90% of them are installed from f-droid. Is there a way to automate the installation of these apps after doing phone reset? I have LineageOS and my phone is rooted with Magisk.

Lineage has VaultSeed backup right?

Magisk allows you to run some other backup tools too, I guess

I am looking for solution more similar to linux package managers, like pacman or apt, where using one command can install all packages at once. Maybe using Termux or adb. I just want to install the apk files, not restoring apps data.

for i in *.apk; do echo "Installing $i..."; adb install $i; done

in termux or adb

i guess i could use this method though it is not very convenient because i have to download manually 100 apk files.

Use an app or a file manager to extract the APKs from the old device