Is it necessary to discard outliers before applying LSTM on time series
Removing or not removing outliers all depends on what you are trying to achieve. You write here that your goal is anomaly detection...so at first glance it seems like a poor idea to remove points or values that you are trying to detect. However, if you detect values that are of such naturethat they cannot even be due to plausible anomalies, then yes, you should remove them. In all other cases you should consider to keep them.
I am trying to detect anomalies on a time series that controls battery voltage output. I find that my original dataset has some outliers. In this case do I need to remove those points using InterQuartile Range (IQR) or Zscore? of course before using the LSTM keras model