Should be quite a few useful posts on this site already with this issue, as its pretty common with this title. Try:
https://pinside.com/pinball/forum/topic/star-trek-next-generation-sttng-locate-ball-problem-stuck-in-loop
https://pinside.com/pinball/forum/topic/star-trek-the-next-generation-ball-location-issue
https://pinside.com/pinball/forum/topic/star-trek-tng-missing-6th-ball
See if you can do some troubleshooting after reading up and post your findings.