Considering both .ybtxt and .ybrar files are ebooks from yBook, using the original software may be the best way to achieve ybtxt to ybrar conversion.
Given the fact that .ybrar files appear to be just RAR compressed .ybtxt files, perhaps you can achieve the same by simply RAR-compressing .ybtxt file and changing the suffix from rar to ybrar.