The reason it’s only storing the first post data is because you’re using the same transient name for each post. If you want to store multiple movie transients, you need unique names for each movie.
Also, the way you’re getting the transient defeats the purpose of using transients. You want to first try to get the transient and if it’s not available, then generate a value and set that as the transient.
Here’s how I would modify your code:
<?php
$cinemamoviename = get_post_meta( $post->ID, "cinama_moviename", true );
$cinemamovieyear = get_post_meta( $post->ID, "cinama_movieyear", true );
$cinemamovienames = urlencode( $cinemamoviename );
$transient_name = "get_movies_data_intrans_$cimemamoviename_$cinemamovieyear";
if( false === ( $movies_details = get_transient( $transient_name ) ) ) {
$args = array(
't' => $cinemamovienames,
'y' => $cinemamovieyear,
'plot' => 'short',
'r' => 'json',
);
$url = add_query_arg( $args, 'http://www.omdbapi.com/' );
$json = wp_remote_get( $url );
$obj = json_decode( $json );
$movies_title = $obj->Title;
$movies_year = $obj->Year;
$movies_datas = array( $movies_title, $movies_year );
set_transient( $transient_name, $movies_datas, 365 * DAY_IN_SECONDS );
}
?>