But want to know why Data Protection API didn't work.
It did work, you just expected more than what it does.
The encryption iOS applies to the files is transparent to anything in the userland. The encryption is done at hardware level, so that nobody who steals the Flash memory of the device can access the data. However, if the screen is unlocked and the device is turned on, the OS handles these files just like every other file, and they don't appear to be "encrypted" from within the filesystem.
If you want to do this, you have to encode the file using some asymmetric encryption method, such as AES (OpenSSL or GnuTLS would do the job well).