Understanding the Impact of Confidence in Retrieval Augmented Generation: A Case Study in the Medical Domain