Problem in while condition

I am unable to figure out what will the while condition to print the next permutation. Also, I cannot understand what we have to print. so I can’t think about it please help me out with this.
my code goes here::
#include
#include
using namespace std;

int main() {

int t,n,arr[10];
cin>>t;
cin>>n;
for(int i=0;i<n;i++)
{
	cin>>arr[i];
}

int arrs = sort(arr, arr+n);
do{
	
for(int i=0;i<n;i++)
{
	cout<<arr[i]<<" ";
}
cout<<endl;
for(int i=0;i<n;i++)
{
	if(arr[i] == arrs[i])
	{
		continue;
	}
	else
	{
		break;
	}
}
}while(next_permutation(arr,arr+n));
return 0;

}