This might be your problem. See What to do when the Mac App Store shows a different Apple ID for software updates https://www.macworld.com/article/3267709/mac-app-store-apple-id.html. This document refers to a prior owner (use the discussion in it this is your situation), but is also applies to cases where a current owner's old Apple ID is the problem. The discussion below relates to the second possibility.
Basically, If an app is purchased/downloaded using one Apple ID, then you can't update it with a second Apple ID. The app is inextricably linked to the first Apple ID. You'll have to delete if from the first Apple ID and purchase/download it again with the second Apple ID.
__________
But, if a prior owner's Apple ID is on the phone, then your problem could be activation lock. If the phone is activation locked, them you must have acquired it second hand. In this regard, see See Turn off Activation Lock https://support.apple.com/en-us/HT201441.
Given that you acquired the device second hand, the following information explains what has happened. You
apparently didn't know to heed the advice given below.
"Before you buy/acquire an iPhone, iPad, or iPod touch from ... [a third party], make sure that the device is erased and no longer linked to the previous owner’s account."
And see: Activation Lock for iPhone, iPad, and iPod touch https://support.apple.com/en-us/HT201365.
See this heading Check for Activation Lock before you buy/acquire a device from someone else.
The presence of activation lock means that we can't help you. We are not authorized to remove the activation lock from any device. And, under your circumstances, Apple support will not remove it since you cannot provide proof of ownership that they will consider to be sufficient. You would need and have your purchase receipt for the device from an authorized Apple seller with the device's serial number on it.*
If you can't contact the prior owner and don't have the receipt, the device is useless to you.
*Rarely, an iDevice is purchased activation locked from an authorized Apple seller.