Usually, it’s against the Google AdSense policy to put regular text & display ads into a floating container to make them sticky on your website:
To ensure a safe and positive user experience, we restrict the use of ad implementations on desktop which cause the ad to appear in a “sticky” or “floating” position on the page as the user scrolls or navigates through the page. While we allow Google anchor ads on mobile web, please note that publisher-created mobile implementations are not permitted as we cannot ensure they have the same quality protections we’ve built into our product.
Fortunately, Google is offering mobile ads that stick to the edge of user’s screen and are easily dismissable. These ads are part of the so called page level ads and they are called anchor/overlay ads:
Read here how to integrate these sticky anchor ads to your website.