Unity comes with a helper method for generating a unique asset paths called AssetDatabase.GenerateUniqueAssetPath. The documentation for this method is rather minimal but the code example below should help you understand how to use it a little better.
[MenuItem("CBX/Test")]
public static void Test()
{
// outputs "Assets/Rules.xml" if "Assets/Rules.xml" file does not already exist.
// if "Assets/Rules.xml" already exists it outputs "Assets/Rules 1.xml"
Debug.Log(AssetDatabase.GenerateUniqueAssetPath("Assets/Rules.xml"));
// expects path to start with "Assets/" & outputs a console error in the console "pathName.find("assets/") == 0"
// then outputs "Rules.xml"
Debug.Log(AssetDatabase.GenerateUniqueAssetPath("Rules.xml"));
}