If something like Ansible is too much, you could list the packages as a bash array in a file
pkgs=(
vim
bash-completion
...
)
Source the file
source pkgs.txt
Then install them
dnf install ${pkgs[@]}
This expands to dnf install vim bash-completion ...
As for listing the installed packages,
dnf repoquery --userinstalled --queryformat '%{name}\n'
The list includes all packages not installed as dependencies, so it's not quite perfect but might be close enough to what you need.
The array expansion workaround should work for other package managers too, as long as they take the list of packages as whitespace-separated arguments.
I've used one called CIFS Documents Provider in the past, worked very well.
It adds SMB/CIFS as a storage provider like Google Drive or Nextcloud to the Android built in file manager.
Available only from Play Store, AFAIK. And I think I was still on Android 14 last I used it.