As long as you're sure you want to install all of those packages then:

# cat 'file' | xargs dnf -y install

should do it. You have to do the -y because dnf will just exit if you don't. You can't run an interactive prompt...

Thanks,
Richard