do SQL Server will flush out the pages and plan which its already in the buffer cache and plan cache or it will remain there in cache although I have cancel the query
Pages will remain in the buffer cache even if the query is cancelled. These will be reused when the query is rerun (assuming they are still in cache) or by other queries needing the same pages.