Renaming a item's custom name in an item frame during data taken from the book on a lectern below

Hi I'm very new so any advice/notice would be great!

As the title says, I'm currently running the following command: /data modify entity [insert item frame target selector] Item.components.minecraft:custom_name set from block ~ ~-1 ~ Book.components.minecraft:written_book_content.pages

The signed book currently has "TEST" written on the first page. When I execute the command, the console has no problem but the item does not take on a new name. After playing around, it seems to completely remove the name (since I tried with an already named item) which I assume is because the sourcePath it's searching for isn't actually from the first page of the book.

Could I get some direction on how to troubleshoot this? Am I completely missing the mark or overlooking the syntax? Thanks.

Continue to help post