I am taking a train to Warminster from London, Warminster to Bath, and Bath to London. Any recommendations on train companies I should use?
You need to use whichever train company operates that route.
Best to start at www.nationalrail.co.uk for details.
London North Eastern Railway, Great Western Railway, and South Western Railway all go to Warminster from London.
You won't find LNER anywhere near Warminster. It is served by GWR from London Paddington via Bath Spa, and by SWR from London Waterloo via Salisbury. Both take just over 2 hours; GWR is much more expensive.
Warminster to Bath Spa by GWR. Bath Spa to Paddington by GWR.
The manual for unsnarling the UK's tangled train system(s), and many other places too, is here:
I have just given the answer - just above.