You are right with the fee (in satoshis) being set depending on the inputs and outputs.
But since the amount of inputs and outputs do have an direct influence on the size and the number you get when calling getfeerate is a feerate (sat / KB; depending on the size), it is perfectly fine to do it this way.
So, following Abdussamad's advice is the correct way to get the fee rate. You'll simply have to set this feerate in your transaction.
Since the unit is sat/ KB, the actual total fee (satoshi) will be calculated when creating the transaction (based on the transaction size).