How to display ad from ad it entered in text field

Is there any way so that my app gets ad id from firebase or any text field and display same ad from those id??/

I would be very very thankful if you can help me through it,