The laws will differ from country to country and in some places from state to state or city to city. We don't know where you live. Best advice would be to talk to a lawyer.
I was wondering if it was illegal to ask a tenant to move out? after notifying them a month prior, I plan to sell the house but obviously it'll take longer than a month to sell it So is it my fault they haven't been looking for a new place
Most places everything depends on whether you rent month to month or if you have a lease. Typically a month's notice is required for a month to month rental verbal ageement; a lease, of course would state the period required.
In any event, it would be nice to give your tenant enough notice as possible to find and secure a place. To know for sure what the laws state you will have to refer to your local tenancy laws.
And .. you can still offer the house for sale even if they are still renting it.
It depends on what is written in your contract. My friend inherited a property from her uncle and he had two tenants. They were obviously aware of his death and the exchange of ownership. She gave them a month to leave and didn't charge them for that month so that they had a deposit for another place. It might be wise to speak to a solicitor. Make sure all agreements are made in writing.